Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import torch
|
| 3 |
from transformers import ViTFeatureExtractor,pipeline
|
| 4 |
|
|
@@ -6,7 +7,7 @@ model = ViTFeatureExtractor.from_pretrained('SeyedAli/Food-Image-Classification-
|
|
| 6 |
|
| 7 |
def FoodClassification(image):
|
| 8 |
pipline = pipeline(task="image-classification", model=model)
|
| 9 |
-
output=pipline(model(image, return_tensors='pt'))
|
| 10 |
return output
|
| 11 |
|
| 12 |
iface = gr.Interface(fn=FoodClassification, inputs="image", outputs="text")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from PIL import Image
|
| 3 |
import torch
|
| 4 |
from transformers import ViTFeatureExtractor,pipeline
|
| 5 |
|
|
|
|
| 7 |
|
| 8 |
def FoodClassification(image):
|
| 9 |
pipline = pipeline(task="image-classification", model=model)
|
| 10 |
+
output=pipline(model(Image.open(image), return_tensors='pt'))
|
| 11 |
return output
|
| 12 |
|
| 13 |
iface = gr.Interface(fn=FoodClassification, inputs="image", outputs="text")
|