Spaces:
Sleeping
Sleeping
Download start_localhost.py from AIBRUH/big-proppa-live: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/AIBRUH/big-proppa-live/resolve/main/start_localhost.py
- Command line
-
hf download hf://spaces/AIBRUH/big-proppa-live/start_localhost.py
-
curl -L -o start_localhost.py https://huggingface.co/spaces/AIBRUH/big-proppa-live/resolve/main/start_localhost.py
1.3 kB
| #!/usr/bin/env python3 | |
| """ | |
| Simple localhost server runner for Hey-Big-Proppa. | |
| """ | |
| import os | |
| import sys | |
| import subprocess | |
| from pathlib import Path | |
| def main(): | |
| print("π Starting Hey-Big-Proppa localhost environment...") | |
| # Check if frontend is built | |
| frontend_dist = Path(__file__).resolve().parent / "frontend" / "dist" | |
| if not frontend_dist.exists(): | |
| print("π¦ Building frontend...") | |
| subprocess.run([ | |
| "npm", | |
| "run", | |
| "build" | |
| ], cwd=Path(__file__).resolve().parent / "frontend") | |
| # Start the backend server | |
| backend_dir = Path(__file__).resolve().parent / "backend" | |
| print(f"π Starting backend server from {backend_dir}...") | |
| print("π Open your browser to: http://localhost:8000") | |
| print("π API docs at: http://localhost:8000/docs") | |
| print("\n\nPress Ctrl+C to stop the server\n") | |
| # Use venv uvicorn | |
| project_root = Path(__file__).resolve().parent | |
| venv_python = project_root / ".venv" / "bin" / "python" | |
| os.chdir(backend_dir) | |
| subprocess.run([ | |
| str(venv_python), | |
| "-m", | |
| "uvicorn", | |
| "main:app", | |
| "--host", | |
| "0.0.0.0", | |
| "--port", | |
| "8000", | |
| "--reload" | |
| ]) | |
| if __name__ == "__main__": | |
| main() |