Prajwall11 commited on
Commit
e6644f7
·
verified ·
1 Parent(s): 2431fe0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
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