KevanSoon
commited on
Commit
·
cdcee06
1
Parent(s):
8f75e3e
adjust endpoint
Browse files
app.py
CHANGED
|
@@ -4,21 +4,15 @@ from gradio_client import Client
|
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
| 7 |
-
# Create Gradio client instance once
|
| 8 |
client = Client("https://kby-ai-facerecognition.hf.space/--replicas/ij0t7/")
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
image1
|
| 13 |
-
image2
|
| 14 |
-
|
| 15 |
-
@app.post("/face-recognition")
|
| 16 |
-
async def face_recognition(data: ImagesInput):
|
| 17 |
-
# Call the Gradio client predict with the URLs from request body
|
| 18 |
result = client.predict(
|
| 19 |
-
|
| 20 |
-
|
| 21 |
fn_index=2
|
| 22 |
)
|
| 23 |
-
# Return the prediction result as JSON
|
| 24 |
return {"result": result}
|
|
|
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
|
|
|
| 7 |
client = Client("https://kby-ai-facerecognition.hf.space/--replicas/ij0t7/")
|
| 8 |
|
| 9 |
+
@app.get("/face-recognition")
|
| 10 |
+
async def face_recognition_get():
|
| 11 |
+
image1 = "https://qvnhhditkzzeudppuezf.supabase.co/storage/v1/object/public/post-images/post-images/1752289670997-kevan.jpg"
|
| 12 |
+
image2 = "https://qvnhhditkzzeudppuezf.supabase.co/storage/v1/object/public/post-images/post-images/1752289670997-kevan.jpg"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
result = client.predict(
|
| 14 |
+
image1,
|
| 15 |
+
image2,
|
| 16 |
fn_index=2
|
| 17 |
)
|
|
|
|
| 18 |
return {"result": result}
|