Spaces:
Runtime error
Runtime error
import gradio as gr | |
from PIL import Image | |
import torch | |
from transformers import ViTImageProcessor,pipeline | |
model = ViTImageProcessor.from_pretrained('SeyedAli/Food-Image-Classification-VIT') | |
def FoodClassification(image): | |
pipline = pipeline(task="image-classification", model=model) | |
output=pipline(model(Image.open(image), return_tensors='pt')) | |
return output | |
iface = gr.Interface(fn=FoodClassification, inputs="image", outputs="text") | |
iface.launch(share=False) |