Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,10 +2,10 @@ import gradio as gr
|
|
2 |
from fastapi import FastAPI
|
3 |
from risk_model import predict_risk, retrain_model, get_history_df
|
4 |
|
5 |
-
# FastAPI
|
6 |
-
|
7 |
|
8 |
-
# Gradio
|
9 |
gradio_app = gr.Blocks()
|
10 |
|
11 |
with gradio_app:
|
@@ -35,9 +35,10 @@ with gradio_app:
|
|
35 |
predict_btn.click(classify, inputs=[temp, duration], outputs=[result, score, history_table])
|
36 |
retrain_btn.click(retrain_model, outputs=[retrain_output])
|
37 |
|
38 |
-
#
|
39 |
-
@
|
40 |
def root():
|
41 |
-
return {"
|
42 |
|
43 |
-
|
|
|
|
2 |
from fastapi import FastAPI
|
3 |
from risk_model import predict_risk, retrain_model, get_history_df
|
4 |
|
5 |
+
# Create FastAPI instance
|
6 |
+
fastapi_app = FastAPI()
|
7 |
|
8 |
+
# Create Gradio app
|
9 |
gradio_app = gr.Blocks()
|
10 |
|
11 |
with gradio_app:
|
|
|
35 |
predict_btn.click(classify, inputs=[temp, duration], outputs=[result, score, history_table])
|
36 |
retrain_btn.click(retrain_model, outputs=[retrain_output])
|
37 |
|
38 |
+
# Optional: basic route to test API is up
|
39 |
+
@fastapi_app.get("/")
|
40 |
def root():
|
41 |
+
return {"status": "Heating Mantle API is live"}
|
42 |
|
43 |
+
# ✅ Hugging Face requires this line exactly
|
44 |
+
app = gr.mount_gradio_app(fastapi_app, gradio_app, path="/predict-ui")
|