Pratham0100 commited on
Commit
18e322a
·
verified ·
1 Parent(s): 477bf82

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +10 -7
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
- def welcome():
11
- return "BrainBox Backend API is running! Access the /docs endpoint."
 
 
12
 
13
- # Dummy Gradio app to satisfy Hugging Face Spaces routing
14
  demo = gr.Interface(
15
- fn=welcome,
16
- inputs=[],
17
  outputs="text",
18
  title="BrainBox API Core"
19
  )
20
 
21
- # Mount FastAPI inside Gradio! Hugging Face automatically detects and runs 'app'
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="/")