Spaces:
Running
Running
Serve the in-browser demo from a minimal Docker file server
Browse filesA static Space redirects LFS/Xet files to a CDN without CORS headers, which blocked the worker's fetch of the bot bundle and the fonts. The container only serves files; PyBot still runs in the browser.
- Dockerfile +11 -0
- README.md +6 -4
Dockerfile
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A plain static file server: PyBot itself runs in the visitor's browser (Pyodide, see worker.js).
|
| 2 |
+
# Docker rather than sdk: static because a static Space redirects large (LFS/Xet) files to a CDN without CORS
|
| 3 |
+
# headers, which blocks the worker's fetch of the bot bundle and the @font-face fonts.
|
| 4 |
+
FROM python:3.12-slim
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
WORKDIR /home/user/www
|
| 8 |
+
COPY --chown=user index.html worker.js pybot_web.py tree.json pybot-*.zip ./
|
| 9 |
+
COPY --chown=user fonts ./fonts
|
| 10 |
+
EXPOSE 7860
|
| 11 |
+
CMD ["python", "-m", "http.server", "7860", "--bind", "0.0.0.0"]
|
README.md
CHANGED
|
@@ -3,8 +3,8 @@ title: PyBot
|
|
| 3 |
emoji: 🐍
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: gray
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
pinned: false
|
| 9 |
datasets:
|
| 10 |
- HuggingFaceSwarms/SwarmChat-v8
|
|
@@ -12,7 +12,7 @@ datasets:
|
|
| 12 |
|
| 13 |
PyBot: a conversational bot without LLMs, written by a swarm of LLM agents. This Space is a chat demo that runs
|
| 14 |
PyBot entirely in your browser: [Pyodide](https://pyodide.org) (CPython compiled to WebAssembly) runs the bot's Python
|
| 15 |
-
in a Web Worker
|
| 16 |
|
| 17 |
The bot is commit `3185a7a9bc50` of `HuggingFaceSwarms/SwarmChat-v8`, the best run on the
|
| 18 |
[SwarmChat leaderboard](https://huggingface.co/spaces/HuggingFaceSwarms/swarmchat-leaderboard) (26.55% length-penalised
|
|
@@ -29,6 +29,8 @@ replies.
|
|
| 29 |
- `pybot-<sha12>.zip`: `bot/**.pyc` compiled for Pyodide's CPython 3.14 (loading skips compiling 33 MB of source),
|
| 30 |
plus `norm.json` (each file's text, letters and digits only) for finding the file that holds a reply.
|
| 31 |
- `tree.json`: PyBot's files and line counts for the treemap.
|
|
|
|
|
|
|
| 32 |
|
| 33 |
## Rebuild for another commit
|
| 34 |
|
|
@@ -40,4 +42,4 @@ node build/build.mjs bot-src.zip build/build_bundle.py pybot-<sha12>.zip
|
|
| 40 |
```
|
| 41 |
|
| 42 |
Then regenerate `tree.json` (`[path, line count]` for every `bot/**.py`, plus `repo` and `sha`) and update `BUNDLE`
|
| 43 |
-
in `worker.js`. To test locally, serve this folder (
|
|
|
|
| 3 |
emoji: 🐍
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: gray
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
datasets:
|
| 10 |
- HuggingFaceSwarms/SwarmChat-v8
|
|
|
|
| 12 |
|
| 13 |
PyBot: a conversational bot without LLMs, written by a swarm of LLM agents. This Space is a chat demo that runs
|
| 14 |
PyBot entirely in your browser: [Pyodide](https://pyodide.org) (CPython compiled to WebAssembly) runs the bot's Python
|
| 15 |
+
in a Web Worker; the Space only serves files. Each reply shows which of PyBot's modules and files produced it.
|
| 16 |
|
| 17 |
The bot is commit `3185a7a9bc50` of `HuggingFaceSwarms/SwarmChat-v8`, the best run on the
|
| 18 |
[SwarmChat leaderboard](https://huggingface.co/spaces/HuggingFaceSwarms/swarmchat-leaderboard) (26.55% length-penalised
|
|
|
|
| 29 |
- `pybot-<sha12>.zip`: `bot/**.pyc` compiled for Pyodide's CPython 3.14 (loading skips compiling 33 MB of source),
|
| 30 |
plus `norm.json` (each file's text, letters and digits only) for finding the file that holds a reply.
|
| 31 |
- `tree.json`: PyBot's files and line counts for the treemap.
|
| 32 |
+
- `Dockerfile`: only serves the files above (`python -m http.server`). A static Space would redirect the large files to a
|
| 33 |
+
CDN without CORS headers, which blocks the worker's fetch of the bundle and the fonts.
|
| 34 |
|
| 35 |
## Rebuild for another commit
|
| 36 |
|
|
|
|
| 42 |
```
|
| 43 |
|
| 44 |
Then regenerate `tree.json` (`[path, line count]` for every `bot/**.py`, plus `repo` and `sha`) and update `BUNDLE`
|
| 45 |
+
in `worker.js`. To test locally, serve this folder (`python -m http.server`) and open it.
|