File size: 3,249 Bytes
62d6859
b67e3ef
281f5b1
62d6859
 
 
281f5b1
da9de03
62d6859
 
b67e3ef
281f5b1
62d6859
 
a416f24
281f5b1
 
 
 
a416f24
281f5b1
 
 
 
a416f24
281f5b1
a416f24
281f5b1
 
 
da9de03
 
 
a416f24
983d2be
 
 
a416f24
983d2be
281f5b1
da9de03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: LUNA
emoji: 🌙
colorFrom: yellow
colorTo: purple
sdk: gradio
sdk_version: 6.14.0
python_version: '3.12'
app_file: app.py
pinned: false
license: apache-2.0
short_description: Latent understanding & narrative assembly from your files
---

# LUNA - Latent Understanding & Narrative Assembly

LUNA is the file-synthesis tool of [Next Neural Labs](https://nnlabs.pl). Drop up to
**100 files of any type** (documents, spreadsheets, code, images, audio, video) into a
**task**, tell LUNA *what to build* (e.g. *"Everything about climate change in Italy"*),
and it returns **one structured Note** - Title, Agenda, themed Body, and a Sources
section that credits every file it actually used.

## How it works

1. **Categorize** - each upload is sorted by type (text / document / image / audio /
   video / spreadsheet / code / …).
2. **Extract in parallel** - content is pulled from every file concurrently to keep cost
   and latency low: documents/sheets/code are parsed to text, images are read by a
   vision-language model (description + on-screen text), audio/video are transcribed with
   Whisper.
3. **Map (note-taking)** - a fast model reads each file (long files in parts, in
   parallel) and writes notes on everything it contains. Nothing is judged or thrown
   away at this stage, so a shaky per-file call can't silently lose a file's content.
4. **Reduce (synthesis)** - a strong model sees every file's extraction together and is the
   final judge of what to use. It fuses the relevant material into the Note (in the language
   of your prompt). If your prompt targets one thing (e.g. *"what's on the video"*), it
   answers from that and sets the unrelated uploads aside instead of summarizing them "just
   in case". A file is either *used* (in the body + Sources) or *not used* (one short line) -
   never both.

The front-end lives at **https://app.nnlabs.pl/luna**. Uploaded files are processed and
then purged (after one hour at the latest); only the generated Note is stored, in the
website's database.

## Running this Space

* **Secrets:** `HF_TOKEN` (inference providers) and `LUNA_SIGNING_SECRET` (shared with the
  website's Worker; without it every call is refused). Optional: `TOKEN_REQUIRE_SCOPE=1`
  once the Worker emits scoped tokens.
* **Hardware:** CPU (`cpu-upgrade`); sleeps after 15 minutes and takes about a minute to
  wake. Whisper `base` is loaded in the background at start.
* **Limits:** 100 files, 25 MB per document, 500 MB per media file and per task; media is
  transcribed up to 30 minutes; reading and note-taking stop at 6 minutes and the Note is
  written from what was read by then.

## API

Every endpoint takes a signed, single-use token minted by the website for that
endpoint's scope. There is no anonymous access.

| api_name | inputs | output |
| --- | --- | --- |
| `build` | files, prompt (may end with `⟦FORMAT⟧` directives), token | streams `[status, note]`; the last status is `✅ done` or `⚠️ degraded: reason` |
| `clarify` | prompt, token | one or two sentences restating the request |

Unsupported formats (`.doc`, `.ppt`, `.rtf`, `.xls`, `.ods`) are listed under "Not used"
with a hint to convert them. Archives are read member by member through the same parsers.