Spaces:
Sleeping
Sleeping
Commit ·
c586065
1
Parent(s): 97f0a68
Let Gradio launch demo cleanly to prevent port 7860 collision
Browse files12345674 unmodified lines121314151617181936 unmodified lines5657585960616263646566#!/usr/bin/env python3"""FALL (SwarmNet) - Hugging Face Space Production Entrypoint (Gradio SDK runtime)Mounts our custom FastAPI & WebSocket UI directly so no Docker billing is needed!"""import sysimport os4 unmodified linesROOT_DIR = os.path.abspath(os.path.dirname(__file__))sys.path.insert(0, ROOT_DIR)from swarmnet.config import CONFIG# 1. Start Miner 1 (Layers 0 to 14) in backgroundprint("⚡ Starting Swarm Miner 01 (Layers 0-14)...")env = os.environ.copy()36 unmodified lines# Gradio mounts our full custom FastAPI suite with WebSocket & Chat Studiodemo = gr.mount_gradio_app(fastapi_app, gr.Blocks(), path="/gradio")# Export for HF Spaces Gradio runnerapp = fastapi_appif __name__ == "__main__":import uvicornport = int(os.environ.get("PORT", 7860))print(f"\n🌐 FALL UI & Swarm Genesis listening on http://0.0.0.0:{port}\n")uvicorn.run(app, host="0.0.0.0", port=port, log_level="info")12345674 unmodified lines12131415161736 unmodified lines5455565758596061#!/usr/bin/env python3"""FALL (SwarmNet) - Hugging Face Space Production EntrypointRuns on standard CPU basic or ZeroGPU runtime."""import sysimport os4 unmodified linesROOT_DIR = os.path.abspath(os.path.dirname(__file__))sys.path.insert(0, ROOT_DIR)# 1. Start Miner 1 (Layers 0 to 14) in backgroundprint("⚡ Starting Swarm Miner 01 (Layers 0-14)...")env = os.environ.copy()36 unmodified lines# Gradio mounts our full custom FastAPI suite with WebSocket & Chat Studiodemo = gr.mount_gradio_app(fastapi_app, gr.Blocks(), path="/gradio")# Export for HF Spaces Gradio runner (HF runs demo.launch() automatically!)app = fastapi_appif __name__ == "__main__":demo.launch(server_name="0.0.0.0", server_port=7860)
app.py+4-9