SeyedAli's picture
Update app.py
c4a9309
raw
history blame
476 Bytes
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)