Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,9 @@ def identify_image(image_path):
|
|
| 12 |
"""Identify the food item in the image."""
|
| 13 |
API_URL = "https://api-inference.huggingface.co/models/nateraw/food"
|
| 14 |
headers = {"Authorization": os.getenv('huggingface')}
|
| 15 |
-
image = Image.open(image_path)
|
|
|
|
|
|
|
| 16 |
response = requests.post(API_URL, headers=headers, data=image)
|
| 17 |
return response.json()[0]['label']
|
| 18 |
|
|
|
|
| 12 |
"""Identify the food item in the image."""
|
| 13 |
API_URL = "https://api-inference.huggingface.co/models/nateraw/food"
|
| 14 |
headers = {"Authorization": os.getenv('huggingface')}
|
| 15 |
+
# image = Image.open(image_path)
|
| 16 |
+
with open(image_path, "rb") as f:
|
| 17 |
+
image = f.read()
|
| 18 |
response = requests.post(API_URL, headers=headers, data=image)
|
| 19 |
return response.json()[0]['label']
|
| 20 |
|