Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +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 |
app = FastAPI()
|
|
|
|
|
6 |
gradio_app = gr.Blocks()
|
7 |
|
8 |
with gradio_app:
|
@@ -32,9 +35,9 @@ with gradio_app:
|
|
32 |
predict_btn.click(classify, inputs=[temp, duration], outputs=[result, score, history_table])
|
33 |
retrain_btn.click(retrain_model, outputs=[retrain_output])
|
34 |
|
35 |
-
# Mount Gradio
|
36 |
@app.get("/")
|
37 |
-
def
|
38 |
-
return {"message": "Heating Mantle Risk API is
|
39 |
|
40 |
app = gr.mount_gradio_app(app, gradio_app, path="/predict-ui")
|
|
|
2 |
from fastapi import FastAPI
|
3 |
from risk_model import predict_risk, retrain_model, get_history_df
|
4 |
|
5 |
+
# FastAPI backend
|
6 |
app = FastAPI()
|
7 |
+
|
8 |
+
# Gradio UI
|
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 |
+
# Mount Gradio UI on FastAPI
|
39 |
@app.get("/")
|
40 |
+
def root():
|
41 |
+
return {"message": "Heating Mantle Risk API is live!"}
|
42 |
|
43 |
app = gr.mount_gradio_app(app, gradio_app, path="/predict-ui")
|