File size: 647 Bytes
32ed852
 
542a039
 
 
32ed852
 
 
 
 
 
 
 
542a039
 
 
 
 
 
 
32ed852
542a039
 
32ed852
542a039
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from transformers import pipeline
from PIL import Image
import gradio as gr
import os

model_name = "larimei/food-classification-ai"

classifier = pipeline("image-classification", model=model_name)

def predict_image(image):
    predictions = classifier(image)
    return predictions[0]['label']


title = "Recipifier"
description = "blablabla"

example_list = [["examples/" + example] for example in os.listdir("examples")]

demo = gr.Interface(
    fn=predict_image,
    inputs=gr.Image(type="pil"),
    outputs=[
        gr.Textbox(label="Recipe")
    ],
    examples=example_list,
    title=title,
    description=description,
)

demo.launch()