nihaluser commited on
Commit
f5ac8bc
·
verified ·
1 Parent(s): aeb8b14

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -51
app.py DELETED
@@ -1,51 +0,0 @@
1
- """
2
- Hugging Face Spaces entry point (Gradio SDK, free tier).
3
-
4
- Docker Spaces are paid, so this file runs the existing FastAPI app from
5
- main.py on the Gradio SDK instead. The API is unchanged:
6
- GET /hello
7
- POST /predict
8
- A small Gradio page is mounted at "/" so the Space has a landing page.
9
- """
10
- import os
11
-
12
- # On ZeroGPU hardware, Hugging Face refuses to start unless at least one
13
- # function is decorated with @spaces.GPU. The model runs on CPU, so this
14
- # placeholder is never called. On CPU hardware (or locally) `spaces` may
15
- # not be installed, and the placeholder is simply skipped.
16
- try:
17
- import spaces
18
-
19
- @spaces.GPU
20
- def _zerogpu_placeholder():
21
- return None
22
- except ImportError:
23
- pass
24
-
25
- import gradio as gr
26
- import uvicorn
27
-
28
- from main import app # the FastAPI app with /hello and /predict
29
-
30
- with gr.Blocks(title="MindScope API") as info_page:
31
- gr.Markdown(
32
- """
33
- # MindScope API
34
- This Space hosts the prediction API for the MindScope project.
35
-
36
- - `GET /hello` — health check
37
- - `POST /predict` — returns `predicted_mental_health_score`
38
- - `/docs` — interactive API documentation
39
-
40
- Educational project. Predictions are machine learning estimates,
41
- not clinical assessments.
42
- """
43
- )
44
-
45
- # Routes defined in main.py are registered first, so they take priority
46
- # over the Gradio page mounted at the root.
47
- app = gr.mount_gradio_app(app, info_page, path="/")
48
-
49
- if __name__ == "__main__":
50
- port = int(os.environ.get("GRADIO_SERVER_PORT", os.environ.get("PORT", 7860)))
51
- uvicorn.run(app, host="0.0.0.0", port=port)