Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import torch | |
| from transformers import pipeline | |
| model_id = "SABR22/food_models" | |
| pipe = pipeline("image-classification", model="Shresthadev403/food-image-classification") | |
| def classify_food(image): | |
| image = pipe(image) | |
| return image[0]['label'] | |
| interface = gr.Interface( | |
| fn=classify_food, | |
| inputs=gr.Image(type="pil"), | |
| outputs=gr.Textbox(), | |
| title="Food Image Classification", | |
| description="Upload a food image and the model will classify it." | |
| ) | |
| interface.launch() |