Spaces:
Running
Running
Restore the Space card (sdk: static)
Browse files
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Event Horizon
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: static
|
| 7 |
+
app_file: index.html
|
| 8 |
+
pinned: false
|
| 9 |
+
license: mit
|
| 10 |
+
short_description: Ask a database a question in English, in the browser
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Event Horizon
|
| 14 |
+
|
| 15 |
+
A database rendered as three stacked skies β tables, the semantic model above
|
| 16 |
+
them, business rules above that β plus a live [Swan](https://github.com/maxdemarzi/swan)
|
| 17 |
+
engine you can ask questions of.
|
| 18 |
+
|
| 19 |
+
**Everything runs in this tab.** DuckDB, the Swan extension and PyRel are
|
| 20 |
+
WebAssembly; the model, the 117 rules and the query all execute in the browser.
|
| 21 |
+
Schema rendering, few-shot selection, the sandbox, error translation and retries
|
| 22 |
+
are all in the browser too.
|
| 23 |
+
|
| 24 |
+
The one thing that leaves is the prompt, which goes to a fine-tuned 1.5B model to
|
| 25 |
+
be turned into PyRel. Two hosts are tried in order β a
|
| 26 |
+
[proxy](https://huggingface.co/spaces/maxdemarzi/black-swan-proxy) onto f16
|
| 27 |
+
weights on a GPU, then a [CPU Space](https://huggingface.co/spaces/maxdemarzi/black-swan-pyrel)
|
| 28 |
+
running the same model quantized β and the status line names the one that
|
| 29 |
+
answered, `gpu` or `cpu`, with `β` when it fell back.
|
| 30 |
+
|
| 31 |
+
The proxy exists because ZeroGPU bills GPU time to a Hugging Face account, and an
|
| 32 |
+
unauthenticated caller gets 2 minutes a day against a PRO account's 40; a request
|
| 33 |
+
from your browser names no account, so it runs out almost immediately. The proxy
|
| 34 |
+
lends one. That daily quota is shared by everyone reading this, so falling back
|
| 35 |
+
to `cpu` is normal rather than a fault. `?nlq=off` disables generation entirely and the rest still
|
| 36 |
+
works β you just write the PyRel yourself.
|
| 37 |
+
|
| 38 |
+
Source: [github.com/maxdemarzi/event_horizon](https://github.com/maxdemarzi/event_horizon)
|
| 39 |
+
|
| 40 |
+
## First visit is slow
|
| 41 |
+
|
| 42 |
+
The engine is ~115 MB of Pyodide, DuckDB and Swan, fetched once and then cached
|
| 43 |
+
in the browser. Loading the demo dataset is behind a button rather than automatic,
|
| 44 |
+
because spending that before anyone has asked for anything reads as a broken page.
|
| 45 |
+
|
| 46 |
+
After the first load the database is kept in IndexedDB, so a second visit
|
| 47 |
+
restores it instead of rebuilding β and the rules are declared rather than
|
| 48 |
+
recomputed, which is the difference between about 25 seconds and about 19.
|