Spaces:
Running
Running
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() |