Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,8 @@ def get_caption(image_path):
|
|
| 24 |
headers = {"Authorization": f"Bearer {HUGGINGFACE_API_KEY}"}
|
| 25 |
|
| 26 |
with open(image_path, "rb") as image_file:
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
if response.status_code == 200:
|
| 30 |
return response.json()[0]['generated_text']
|
|
|
|
| 24 |
headers = {"Authorization": f"Bearer {HUGGINGFACE_API_KEY}"}
|
| 25 |
|
| 26 |
with open(image_path, "rb") as image_file:
|
| 27 |
+
files = {"image": image_file} # Change from "file" to "image"
|
| 28 |
+
response = requests.post(MODEL_URL, headers=headers, files=files)
|
| 29 |
|
| 30 |
if response.status_code == 200:
|
| 31 |
return response.json()[0]['generated_text']
|