Commit
·
ea1b581
1
Parent(s):
0c96937
Final
Browse files
app.py
CHANGED
|
@@ -50,6 +50,19 @@ food_info = {
|
|
| 50 |
}
|
| 51 |
}
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
def predict(my_image):
|
| 54 |
image = Image.fromarray(my_image.astype('uint8'))
|
| 55 |
|
|
@@ -68,5 +81,9 @@ iface = gr.Interface(fn=predict,
|
|
| 68 |
inputs='image',
|
| 69 |
outputs=[gr.Label(num_top_classes=5, label="Predictions"),
|
| 70 |
gr.Text(label='Description'),
|
| 71 |
-
gr.Text(label='Calories and Health Info')]
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
}
|
| 52 |
|
| 53 |
+
title = "Foodie 🍕"
|
| 54 |
+
description = " Image classification model capable of accurately predicting 10 different foods."
|
| 55 |
+
article = "Can predict the following 10 classes: Breakfast Burrito, Caesar Salad, Chicken Quesadilla, Club Sandwich, Donuts, Fish And Chips, Hamburger, Pizza, Samosa and Waffles."
|
| 56 |
+
|
| 57 |
+
import os
|
| 58 |
+
|
| 59 |
+
folder_path = "Images"
|
| 60 |
+
example_list = []
|
| 61 |
+
if os.path.exists(folder_path) and os.path.isdir(folder_path):
|
| 62 |
+
file_paths = [os.path.join(folder_path, file_name) for file_name in os.listdir(folder_path)]
|
| 63 |
+
for file_path in file_paths:
|
| 64 |
+
example_list.append(file_path)
|
| 65 |
+
|
| 66 |
def predict(my_image):
|
| 67 |
image = Image.fromarray(my_image.astype('uint8'))
|
| 68 |
|
|
|
|
| 81 |
inputs='image',
|
| 82 |
outputs=[gr.Label(num_top_classes=5, label="Predictions"),
|
| 83 |
gr.Text(label='Description'),
|
| 84 |
+
gr.Text(label='Calories and Health Info')],
|
| 85 |
+
title=title,
|
| 86 |
+
description=description,
|
| 87 |
+
article=article,
|
| 88 |
+
examples=example_list)
|
| 89 |
+
iface.launch()
|