Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -85,7 +85,7 @@ def process_food_result(image):
|
|
| 85 |
|
| 86 |
|
| 87 |
output_en = f"""
|
| 88 |
-
|
| 89 |
Serving Size: {serving_size_text_en}
|
| 90 |
Calories: {calories} kcal
|
| 91 |
Protein: {protein}g
|
|
@@ -96,21 +96,6 @@ def process_food_result(image):
|
|
| 96 |
Fat: {fat}g
|
| 97 |
"""
|
| 98 |
return output_en
|
| 99 |
-
# # For English output
|
| 100 |
-
# output_en = f"""
|
| 101 |
-
# <div style='text-align: left;'>
|
| 102 |
-
# <b>Food</b>: {food_item}<br>
|
| 103 |
-
# <b>Serving Size</b>: {serving_size_text_en}<br>
|
| 104 |
-
# <b>Calories</b>: {calories} kcal<br>
|
| 105 |
-
# <b>Protein</b>: {protein}g<br>
|
| 106 |
-
# <b>Carbohydrates</b>: {carbs}g<br>
|
| 107 |
-
# <b>Sugars</b>: {sugars}g<br>
|
| 108 |
-
# <b>Fiber</b>: {fiber}g<br>
|
| 109 |
-
# <b>Sodium</b>: {sodium}mg<br>
|
| 110 |
-
# <b>Fat</b>: {fat}g
|
| 111 |
-
# </div>
|
| 112 |
-
# """
|
| 113 |
-
# return output_en
|
| 114 |
|
| 115 |
# Gradio interface function
|
| 116 |
def gradio_function(image):
|
|
@@ -122,10 +107,10 @@ def gradio_function(image):
|
|
| 122 |
# Setup the Gradio interface
|
| 123 |
iface = gr.Interface(
|
| 124 |
fn=gradio_function, # Function to call
|
| 125 |
-
inputs=[gr.Image(type="pil", label="Upload an image")],
|
| 126 |
-
outputs=gr.Textbox(label="Food and Nutrition Information"),
|
| 127 |
-
title="
|
| 128 |
-
description="Upload an image of food, and the tool will recognize it and provide nutritional information
|
| 129 |
)
|
| 130 |
|
| 131 |
# Launch the Gradio interface with debug mode enabled
|
|
|
|
| 85 |
|
| 86 |
|
| 87 |
output_en = f"""
|
| 88 |
+
Food: {food_item}
|
| 89 |
Serving Size: {serving_size_text_en}
|
| 90 |
Calories: {calories} kcal
|
| 91 |
Protein: {protein}g
|
|
|
|
| 96 |
Fat: {fat}g
|
| 97 |
"""
|
| 98 |
return output_en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
# Gradio interface function
|
| 101 |
def gradio_function(image):
|
|
|
|
| 107 |
# Setup the Gradio interface
|
| 108 |
iface = gr.Interface(
|
| 109 |
fn=gradio_function, # Function to call
|
| 110 |
+
inputs=[gr.Image(type="pil", label="Upload an image")],
|
| 111 |
+
outputs=gr.Textbox(label="Food and Nutrition Information"),
|
| 112 |
+
title="Food Recognition and Nutrition Info Tool", # Title of the Gradio interface
|
| 113 |
+
description="Upload an image of food, and the tool will recognize it and provide nutritional information." # Description of the tool
|
| 114 |
)
|
| 115 |
|
| 116 |
# Launch the Gradio interface with debug mode enabled
|