Spaces:
Sleeping
Sleeping
Download app.py from janggi3/agent_system: direct link, hf CLI and curl.
- Browser
- Download file 761 Bytes
-
https://huggingface.co/spaces/janggi3/agent_system/resolve/main/app.py
- Command line
-
hf download hf://spaces/janggi3/agent_system/app.py
-
curl -L -o app.py https://huggingface.co/spaces/janggi3/agent_system/resolve/main/app.py
761 Bytes
| import os | |
| import uvicorn | |
| from fastapi import FastAPI | |
| import gradio as gr | |
| from main_service import app as fastapi_app | |
| from commercial_dashboard import demo as gradio_demo | |
| # This is the secret sauce for Hugging Face: | |
| # Mount the FastAPI (Brain) and Gradio (Dashboard) on the same server! | |
| os.environ["UNIFIED_MODE"] = "1" | |
| app = FastAPI() | |
| # Mount existing Brain Service routes | |
| app.mount("/api", fastapi_app) | |
| def health(): | |
| return {"status": "ok", "components": ["fastapi", "gradio"]} | |
| # Wrap the Gradio App | |
| app = gr.mount_gradio_app(app, gradio_demo, path="/", | |
| allowed_paths=[os.getcwd()]) | |
| if __name__ == "__main__": | |
| # HF looks for an app running on port 7860 | |
| uvicorn.run(app, host="0.0.0.0", port=7860) | |