hassan526 commited on
Commit
49cbdd7
·
verified ·
1 Parent(s): 2896787

Update gradio/app.py

Browse files
Files changed (1) hide show
  1. gradio/app.py +13 -5
gradio/app.py CHANGED
@@ -274,13 +274,21 @@ app = FastAPI()
274
 
275
  @app.post("/api/compare_face")
276
  async def compare_face(image1: UploadFile = File(...), image2: UploadFile = File(...)) -> Dict:
277
- # Process the uploaded images
278
- return {"match": True}
 
 
279
 
280
  if __name__ == '__main__':
281
  g_activation_result = activate_sdk()
282
  # launch_demo(g_activation_result)
 
 
 
 
 
283
 
284
- gr_app = gr.mount_gradio_app(app, gr.Interface(lambda: None, [], [])) # dummy UI just to mount
285
-
286
- gr_app.launch()
 
 
274
 
275
  @app.post("/api/compare_face")
276
  async def compare_face(image1: UploadFile = File(...), image2: UploadFile = File(...)) -> Dict:
277
+ # Load image bytes, run comparison...
278
+ # For now, return a dummy result
279
+ return {"match": True, "confidence": 0.94}
280
+
281
 
282
  if __name__ == '__main__':
283
  g_activation_result = activate_sdk()
284
  # launch_demo(g_activation_result)
285
+ dummy_interface = gr.Interface(
286
+ fn=lambda x: "API ready.",
287
+ inputs=gr.Textbox(label="Info"),
288
+ outputs=gr.Textbox(label="Response")
289
+ )
290
 
291
+ gr_app = gr.mount_gradio_app(app, dummy_interface)
292
+
293
+ import uvicorn
294
+ uvicorn.run(gr_app, host="0.0.0.0", port=7860)