Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -131,11 +131,15 @@ iface = gr.Interface(
|
|
| 131 |
inputs=gr.JSON(label="ratios JSON (dict of feature -> value)"),
|
| 132 |
outputs="json",
|
| 133 |
title="Static Fingerprint Model API",
|
| 134 |
-
description=
|
| 135 |
-
|
| 136 |
-
"and returns probabilities + predicted state."
|
| 137 |
-
),
|
| 138 |
-
api_name="predict", # <<< ADD THIS LINE
|
| 139 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
if __name__ == "__main__":
|
| 141 |
-
|
|
|
|
|
|
| 131 |
inputs=gr.JSON(label="ratios JSON (dict of feature -> value)"),
|
| 132 |
outputs="json",
|
| 133 |
title="Static Fingerprint Model API",
|
| 134 |
+
description="POST your 21 ratios. Returns probabilities + predicted state.",
|
| 135 |
+
api_name="predict", # <--- this line is what creates the API
|
|
|
|
|
|
|
|
|
|
| 136 |
)
|
| 137 |
+
|
| 138 |
+
# ⚠️ Use gr.mount_gradio_app to make /gradio_api/ routes appear
|
| 139 |
+
from fastapi import FastAPI
|
| 140 |
+
app = FastAPI()
|
| 141 |
+
app = gr.mount_gradio_app(app, iface, path="/") # mount Gradio onto FastAPI root
|
| 142 |
+
|
| 143 |
if __name__ == "__main__":
|
| 144 |
+
import uvicorn
|
| 145 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|