Download scripts/run-backend.js from Woodiee/MindRAG: direct link, hf CLI and curl.
- Browser
- Download file 763 Bytes
-
https://huggingface.co/spaces/Woodiee/MindRAG/resolve/main/scripts/run-backend.js
- Command line
-
hf download hf://spaces/Woodiee/MindRAG/scripts/run-backend.js
-
curl -L -o run-backend.js https://huggingface.co/spaces/Woodiee/MindRAG/resolve/main/scripts/run-backend.js
763 Bytes
| const { spawn } = require("child_process"); | |
| const fs = require("fs"); | |
| const path = require("path"); | |
| const root = path.join(__dirname, ".."); | |
| const backendDir = path.join(root, "backend"); | |
| const isWin = process.platform === "win32"; | |
| const python = path.join( | |
| backendDir, | |
| isWin ? ".venv/Scripts/python.exe" : ".venv/bin/python" | |
| ); | |
| if (!fs.existsSync(python)) { | |
| console.error( | |
| "Backend venv not found. Run:\n cd backend\n python -m venv .venv\n .venv\\Scripts\\activate\n pip install -r requirements.txt" | |
| ); | |
| process.exit(1); | |
| } | |
| const child = spawn( | |
| python, | |
| ["-m", "uvicorn", "app.main:app", "--reload", "--host", "127.0.0.1", "--port", "8000"], | |
| { cwd: backendDir, stdio: "inherit" } | |
| ); | |
| child.on("exit", (code) => process.exit(code ?? 1)); | |