Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,8 +2,12 @@ import gradio as gr
|
|
2 |
from transformers import ViTImageProcessor, ViTForImageClassification
|
3 |
from PIL import Image
|
4 |
import requests
|
5 |
-
|
6 |
-
hotdog_image = Image.open(requests.get(
|
|
|
|
|
|
|
|
|
7 |
|
8 |
def snacks_classifier(input_image):
|
9 |
|
@@ -21,6 +25,6 @@ def snacks_classifier(input_image):
|
|
21 |
|
22 |
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
23 |
gr.Interface(fn=snacks_classifier, inputs="image", outputs=gr.Label(num_top_classes=20, label="Prediction"),
|
24 |
-
examples=[hotdog_image])
|
25 |
|
26 |
demo.launch()
|
|
|
2 |
from transformers import ViTImageProcessor, ViTForImageClassification
|
3 |
from PIL import Image
|
4 |
import requests
|
5 |
+
hotdog_url = 'https://potatorolls.com/wp-content/uploads/2020/10/Basic-Hot-Dogs-960x640.jpg'
|
6 |
+
hotdog_image = Image.open(requests.get(hotdog_url, stream=True).raw)
|
7 |
+
muffin_url = "https://www.recipetineats.com/wp-content/uploads/2023/05/Up-and-go-breakfast-muffins_9.jpg"
|
8 |
+
muffin_image = Image.open(requests.get(muffin_url, stream=True).raw)
|
9 |
+
juice_url = "https://recipes.net/wp-content/uploads/2024/01/how-to-drink-fresh-juice-1705739043.jpg"
|
10 |
+
juice_image = Image.open(requests.get(juice_url, stream=True).raw)
|
11 |
|
12 |
def snacks_classifier(input_image):
|
13 |
|
|
|
25 |
|
26 |
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
27 |
gr.Interface(fn=snacks_classifier, inputs="image", outputs=gr.Label(num_top_classes=20, label="Prediction"),
|
28 |
+
examples=[hotdog_image, muffin_image, juice_image])
|
29 |
|
30 |
demo.launch()
|