Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,22 +1,25 @@
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
import gradio as gr
|
|
|
|
| 4 |
|
| 5 |
# Add src to python path so neural_archaeology module is found
|
| 6 |
-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "src"
|
| 7 |
|
| 8 |
from backend.main import app as fastapi_app
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
# Dummy Gradio app to satisfy Hugging Face Spaces routing
|
| 14 |
demo = gr.Interface(
|
| 15 |
-
fn=
|
| 16 |
-
inputs=[],
|
| 17 |
outputs="text",
|
| 18 |
title="BrainBox API Core"
|
| 19 |
)
|
| 20 |
|
| 21 |
-
# Mount FastAPI inside Gradio! Hugging Face
|
| 22 |
app = gr.mount_gradio_app(fastapi_app, demo, path="/")
|
|
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
import gradio as gr
|
| 4 |
+
import spaces
|
| 5 |
|
| 6 |
# Add src to python path so neural_archaeology module is found
|
| 7 |
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "src")))
|
| 8 |
|
| 9 |
from backend.main import app as fastapi_app
|
| 10 |
|
| 11 |
+
# Dummy GPU function to satisfy ZeroGPU hardware requirements
|
| 12 |
+
@spaces.GPU
|
| 13 |
+
def fake_gpu_function():
|
| 14 |
+
return "BrainBox Backend API is running! Access the frontend to use it."
|
| 15 |
|
| 16 |
+
# Dummy Gradio app to satisfy Hugging Face Spaces routing requirements
|
| 17 |
demo = gr.Interface(
|
| 18 |
+
fn=fake_gpu_function,
|
| 19 |
+
inputs=[],
|
| 20 |
outputs="text",
|
| 21 |
title="BrainBox API Core"
|
| 22 |
)
|
| 23 |
|
| 24 |
+
# Mount FastAPI inside Gradio! Hugging Face's runner will automatically launch this.
|
| 25 |
app = gr.mount_gradio_app(fastapi_app, demo, path="/")
|