Spaces:
Runtime error
Runtime error
Commit
·
7c13927
1
Parent(s):
5dd1cbf
fixing endpoint call
Browse files
main.py
CHANGED
|
@@ -85,8 +85,8 @@ async def upload_and_encode_image(file: UploadFile = File(...)):
|
|
| 85 |
except Exception as e:
|
| 86 |
raise HTTPException(status_code=400, detail=f"Invalid file: {e}")
|
| 87 |
|
| 88 |
-
@app.
|
| 89 |
-
def predict(data:
|
| 90 |
"""
|
| 91 |
Generates a description for an image using the Qwen-2-VL model.
|
| 92 |
|
|
|
|
| 85 |
except Exception as e:
|
| 86 |
raise HTTPException(status_code=400, detail=f"Invalid file: {e}")
|
| 87 |
|
| 88 |
+
@app.post("/predict")
|
| 89 |
+
def predict(data: any = Query(...)):
|
| 90 |
"""
|
| 91 |
Generates a description for an image using the Qwen-2-VL model.
|
| 92 |
|
model.py
CHANGED
|
@@ -28,7 +28,7 @@ predict_payload = {
|
|
| 28 |
"prompt": "describe the image",
|
| 29 |
}
|
| 30 |
|
| 31 |
-
predict_response = requests.
|
| 32 |
|
| 33 |
# Step 4: Print the response
|
| 34 |
if predict_response.status_code == 200:
|
|
|
|
| 28 |
"prompt": "describe the image",
|
| 29 |
}
|
| 30 |
|
| 31 |
+
predict_response = requests.post(f"{BASE_URL}/predict", params=predict_payload)
|
| 32 |
|
| 33 |
# Step 4: Print the response
|
| 34 |
if predict_response.status_code == 200:
|