Spaces:
Running
Running
Download run_deepshell.py from muralipala/deepshell: direct link, hf CLI and curl.
- Browser
- Download file 929 Bytes
-
https://huggingface.co/spaces/muralipala/deepshell/resolve/main/run_deepshell.py
- Command line
-
hf download hf://spaces/muralipala/deepshell/run_deepshell.py
-
curl -L -o run_deepshell.py https://huggingface.co/spaces/muralipala/deepshell/resolve/main/run_deepshell.py
929 Bytes
| import subprocess | |
| import sys | |
| import os | |
| import signal | |
| def start_backend(): | |
| env = os.environ.copy() | |
| # Ensure backend path is on PYTHONPATH | |
| backend_dir = os.path.join(os.getcwd(), "deepshell-backend") | |
| env["PYTHONPATH"] = backend_dir + os.pathsep + env.get("PYTHONPATH", "") | |
| # Respect env vars already set in shell (PROVIDER, GROQ_API_KEY, LLM_MODEL, PORT) | |
| # Run the deepshell package (__main__.py) which exposes the FastAPI app | |
| cmd = [sys.executable, "-m", "deepshell"] | |
| process = subprocess.Popen(cmd, env=env, cwd=backend_dir) | |
| print(f"DeepShell backend started with PID {process.pid}") | |
| return process | |
| def main(): | |
| backend_process = start_backend() | |
| try: | |
| backend_process.wait() | |
| except KeyboardInterrupt: | |
| print("Stopping DeepShell backend...") | |
| backend_process.send_signal(signal.SIGINT) | |
| backend_process.wait() | |
| if __name__ == "__main__": | |
| main() | |