Spaces:
Runtime error
Runtime error
Download tests/dev_server.py from bhyve/bhyve-projects: direct link, hf CLI and curl.
- Browser
- Download file 909 Bytes
-
https://huggingface.co/spaces/bhyve/bhyve-projects/resolve/main/tests/dev_server.py
- Command line
-
hf download hf://spaces/bhyve/bhyve-projects/tests/dev_server.py
-
curl -L -o dev_server.py https://huggingface.co/spaces/bhyve/bhyve-projects/resolve/main/tests/dev_server.py
909 Bytes
| """Dev-only launcher: runs the real app with a deterministic FakeLLM injected, so the full UI | |
| flow can be exercised in a browser WITHOUT a Gemini API key. | |
| This is test scaffolding, NOT part of the shipped application (the app always wires the real | |
| Gemini client). Run it with: | |
| uv run python tests/dev_server.py # serves http://127.0.0.1:8765 | |
| """ | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| import uvicorn | |
| from app.deps import get_llm, get_session_manager | |
| from app.main import app | |
| from app.services.session import SessionManager | |
| from tests.fakes import FakeLLM | |
| _fake = FakeLLM(token_count=5000) | |
| _sessions = SessionManager() | |
| app.dependency_overrides[get_llm] = lambda: _fake | |
| app.dependency_overrides[get_session_manager] = lambda: _sessions | |
| if __name__ == "__main__": | |
| uvicorn.run(app, host="127.0.0.1", port=8765, log_level="warning") | |