Spaces:
Running
Running
Update gradio/app.py
Browse files- gradio/app.py +1 -31
gradio/app.py
CHANGED
@@ -266,36 +266,6 @@ def launch_demo(activate_result):
|
|
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 = FastAPI()
|
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 |
-
@app.post("/api/compare_face_base64")
|
282 |
-
async def compare_face_base64() -> Dict:
|
283 |
-
# Load image bytes, run comparison...
|
284 |
-
# For now, return a dummy result
|
285 |
-
return {"match": True, "confidence": 0.64}
|
286 |
-
|
287 |
if __name__ == '__main__':
|
288 |
g_activation_result = activate_sdk()
|
289 |
-
|
290 |
-
|
291 |
-
dummy_interface = gr.Interface(
|
292 |
-
fn=lambda x: "API ready.",
|
293 |
-
inputs=gr.Textbox(label="Info"),
|
294 |
-
outputs=gr.Textbox(label="Response"),
|
295 |
-
allow_flagging="never" # 🚫 disables writing to `flagged/`
|
296 |
-
)
|
297 |
-
|
298 |
-
gr_app = gr.mount_gradio_app(app, dummy_interface, path="/gradio")
|
299 |
-
|
300 |
-
import uvicorn
|
301 |
-
uvicorn.run(gr_app, host="0.0.0.0", port=7860)
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|