Abdulrahman Al-Ghamdi
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -31,8 +31,7 @@ def food_recognizer(image):
|
|
31 |
def nutrition_info(food):
|
32 |
# Prepare the data for the API request
|
33 |
data = {
|
34 |
-
"query": food
|
35 |
-
"timezone": "US/Eastern"
|
36 |
}
|
37 |
|
38 |
# Send a POST request to the Nutritionix API with the food item
|
@@ -134,6 +133,7 @@ image_urls = [
|
|
134 |
|
135 |
# Download the images and use their paths
|
136 |
example_images = [wget.download(url) for url in image_urls]
|
|
|
137 |
|
138 |
|
139 |
# Setup the Gradio interface
|
@@ -144,7 +144,7 @@ iface = gr.Interface(
|
|
144 |
outputs=gr.HTML(label="Food and Nutrition Information"), # Output: HTML for displaying nutrition info
|
145 |
title="Bilingual Food Recognition and Nutrition Info Tool", # Title of the Gradio interface
|
146 |
description="Upload an image of food, and the tool will recognize it and provide nutritional information in both English or Arabic languages.", # Description of the tool
|
147 |
-
examples=
|
148 |
)
|
149 |
|
150 |
# Launch the Gradio interface with debug mode enabled
|
|
|
31 |
def nutrition_info(food):
|
32 |
# Prepare the data for the API request
|
33 |
data = {
|
34 |
+
"query": food
|
|
|
35 |
}
|
36 |
|
37 |
# Send a POST request to the Nutritionix API with the food item
|
|
|
133 |
|
134 |
# Download the images and use their paths
|
135 |
example_images = [wget.download(url) for url in image_urls]
|
136 |
+
examples = [[img] for img in example_images]
|
137 |
|
138 |
|
139 |
# Setup the Gradio interface
|
|
|
144 |
outputs=gr.HTML(label="Food and Nutrition Information"), # Output: HTML for displaying nutrition info
|
145 |
title="Bilingual Food Recognition and Nutrition Info Tool", # Title of the Gradio interface
|
146 |
description="Upload an image of food, and the tool will recognize it and provide nutritional information in both English or Arabic languages.", # Description of the tool
|
147 |
+
examples=examples # Add examples with the image and language
|
148 |
)
|
149 |
|
150 |
# Launch the Gradio interface with debug mode enabled
|