rabie54654 commited on
Commit
a2c2e91
·
1 Parent(s): 2ea4eb5

Add dummy GPU function for ZeroGPU

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -20,9 +20,17 @@ nltk.download('omw-1.4')
20
  from Backend.api import app as fastapi_app
21
 
22
  # Create a minimal Gradio UI to satisfy ZeroGPU's requirements
 
 
 
 
 
23
  with gr.Blocks() as demo:
24
- gr.Markdown("# Math Search Engine is running!")
25
  gr.Markdown("The React frontend is served via FastAPI at the root URL.")
 
 
 
26
 
27
  # Mount FastAPI onto the Gradio app (or vice versa)
28
  # We serve Gradio at /gradio, and the rest is our FastAPI app (which serves React)
 
20
  from Backend.api import app as fastapi_app
21
 
22
  # Create a minimal Gradio UI to satisfy ZeroGPU's requirements
23
+ @spaces.GPU
24
+ def dummy_gpu_task():
25
+ # ZeroGPU requires at least one GPU function to exist
26
+ return "GPU is working!"
27
+
28
  with gr.Blocks() as demo:
29
+ gr.Markdown("# Math Search Engine API")
30
  gr.Markdown("The React frontend is served via FastAPI at the root URL.")
31
+ btn = gr.Button("Ping GPU")
32
+ out = gr.Textbox()
33
+ btn.click(dummy_gpu_task, outputs=out)
34
 
35
  # Mount FastAPI onto the Gradio app (or vice versa)
36
  # We serve Gradio at /gradio, and the rest is our FastAPI app (which serves React)