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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -2,16 +2,16 @@ from PIL import Image
2
  import warnings
3
  import requests
4
  import gradio as gr
5
-
6
  warnings.filterwarnings('ignore')
7
 
8
  # API key for the nutrition information
9
- api_key = nutrient
10
 
11
  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": api_key}
15
  image = Image.open(image_path)
16
  response = requests.post(API_URL, headers=headers, data=image)
17
  return response.json()[0]['label']
 
2
  import warnings
3
  import requests
4
  import gradio as gr
5
+ import os
6
  warnings.filterwarnings('ignore')
7
 
8
  # API key for the nutrition information
9
+ api_key = os.getenv('nutrient')
10
 
11
  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']