Spaces:
Runtime error
Runtime error
Commit
·
bc80882
1
Parent(s):
c229531
fixing messages
Browse files
main.py
CHANGED
|
@@ -135,13 +135,7 @@ def predict(data: PredictRequest):
|
|
| 135 |
|
| 136 |
messages = [
|
| 137 |
{"role": "system", "content": "You are a helpful assistant with vision abilities."},
|
| 138 |
-
{
|
| 139 |
-
"role": "user",
|
| 140 |
-
"content": [
|
| 141 |
-
{"type": "image", "image": f"data:image;base64,{image}"} for image in data.image_base64
|
| 142 |
-
]
|
| 143 |
-
+ [{"type": "text", "text": data.prompt}],
|
| 144 |
-
},
|
| 145 |
]
|
| 146 |
|
| 147 |
print("messages: ", messages)
|
|
|
|
| 135 |
|
| 136 |
messages = [
|
| 137 |
{"role": "system", "content": "You are a helpful assistant with vision abilities."},
|
| 138 |
+
{"role": "user", "content": [{"type": "image", "image": data.image_base64}, {"type": "text", "text": data.prompt}]},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
]
|
| 140 |
|
| 141 |
print("messages: ", messages)
|
model.py
CHANGED
|
@@ -28,10 +28,12 @@ predict_payload = {
|
|
| 28 |
"prompt": "describe the image",
|
| 29 |
}
|
| 30 |
|
|
|
|
|
|
|
| 31 |
predict_response = requests.post(f"{BASE_URL}/predict", json=predict_payload)
|
| 32 |
|
| 33 |
|
| 34 |
-
# Step 4: Print the response
|
| 35 |
if predict_response.status_code == 200:
|
| 36 |
print("Response:", predict_response.json())
|
| 37 |
else:
|
|
|
|
| 28 |
"prompt": "describe the image",
|
| 29 |
}
|
| 30 |
|
| 31 |
+
print("Payload:", predict_payload)
|
| 32 |
+
|
| 33 |
predict_response = requests.post(f"{BASE_URL}/predict", json=predict_payload)
|
| 34 |
|
| 35 |
|
| 36 |
+
# # Step 4: Print the response
|
| 37 |
if predict_response.status_code == 200:
|
| 38 |
print("Response:", predict_response.json())
|
| 39 |
else:
|