Spaces:
Sleeping
Sleeping
Update gradio/app.py
Browse files- gradio/app.py +16 -1
gradio/app.py
CHANGED
|
@@ -265,7 +265,22 @@ def launch_demo(activate_result):
|
|
| 265 |
compare_face_button.click(compare_face_clicked, inputs=[compare_face_input1, compare_face_input2, txt_threshold], outputs=[face_output1, face_output2, compare_result, similarity_markdown, txt_bbox1, txt_bbox2, txt_feature1, txt_feature2, txt_speed])
|
| 266 |
|
| 267 |
demo.launch(server_name="0.0.0.0", server_port=7860, show_api=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
|
| 269 |
if __name__ == '__main__':
|
| 270 |
g_activation_result = activate_sdk()
|
| 271 |
-
launch_demo(g_activation_result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
compare_face_button.click(compare_face_clicked, inputs=[compare_face_input1, compare_face_input2, txt_threshold], outputs=[face_output1, face_output2, compare_result, similarity_markdown, txt_bbox1, txt_bbox2, txt_feature1, txt_feature2, txt_speed])
|
| 266 |
|
| 267 |
demo.launch(server_name="0.0.0.0", server_port=7860, show_api=False)
|
| 268 |
+
|
| 269 |
+
import gradio as gr
|
| 270 |
+
from fastapi import FastAPI, File, UploadFile
|
| 271 |
+
from typing import Dict
|
| 272 |
+
|
| 273 |
+
@app.post("/api/compare_face")
|
| 274 |
+
async def compare_face(image1: UploadFile = File(...), image2: UploadFile = File(...)) -> Dict:
|
| 275 |
+
# Process the uploaded images
|
| 276 |
+
return {"match": True}
|
| 277 |
|
| 278 |
if __name__ == '__main__':
|
| 279 |
g_activation_result = activate_sdk()
|
| 280 |
+
# launch_demo(g_activation_result)
|
| 281 |
+
|
| 282 |
+
app = FastAPI()
|
| 283 |
+
|
| 284 |
+
gr_app = gr.mount_gradio_app(app, gr.Interface(lambda: None, [], [])) # dummy UI just to mount
|
| 285 |
+
|
| 286 |
+
gr_app.launch()
|