COCODEDE04 commited on
Commit
c32dc38
·
verified ·
1 Parent(s): b86dfe3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
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
- "POST a dict of your 21 ratios. Server normalises using saved means/stds "
136
- "and returns probabilities + predicted state."
137
- ),
138
- api_name="predict", # <<< ADD THIS LINE
139
  )
 
 
 
 
 
 
140
  if __name__ == "__main__":
141
- iface.launch()
 
 
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)