Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- server/app.py +13 -0
server/app.py
CHANGED
|
@@ -44,6 +44,7 @@ except ImportError:
|
|
| 44 |
from tasks import REGISTRY, task_from_dict
|
| 45 |
from server.queryforge_environment import QueryforgeEnvironment
|
| 46 |
|
|
|
|
| 47 |
from fastapi import HTTPException
|
| 48 |
|
| 49 |
|
|
@@ -88,6 +89,18 @@ async def delete_task(task_id: str):
|
|
| 88 |
raise HTTPException(status_code=404, detail=f"Task '{task_id}' not found.")
|
| 89 |
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
def main(host: str = "0.0.0.0", port: int = 8000):
|
| 92 |
"""
|
| 93 |
Entry point for direct execution via uv run or python -m.
|
|
|
|
| 44 |
from tasks import REGISTRY, task_from_dict
|
| 45 |
from server.queryforge_environment import QueryforgeEnvironment
|
| 46 |
|
| 47 |
+
import gradio as gr
|
| 48 |
from fastapi import HTTPException
|
| 49 |
|
| 50 |
|
|
|
|
| 89 |
raise HTTPException(status_code=404, detail=f"Task '{task_id}' not found.")
|
| 90 |
|
| 91 |
|
| 92 |
+
# ββ Gradio demo β mounted at /demo so the HF Space App tab shows it βββββββββββ
|
| 93 |
+
|
| 94 |
+
try:
|
| 95 |
+
import sys, os
|
| 96 |
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 97 |
+
from demo import demo as gradio_demo
|
| 98 |
+
app = gr.mount_gradio_app(app, gradio_demo, path="/demo")
|
| 99 |
+
except Exception as _e:
|
| 100 |
+
import warnings
|
| 101 |
+
warnings.warn(f"Gradio demo not mounted: {_e}")
|
| 102 |
+
|
| 103 |
+
|
| 104 |
def main(host: str = "0.0.0.0", port: int = 8000):
|
| 105 |
"""
|
| 106 |
Entry point for direct execution via uv run or python -m.
|