Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,14 +8,14 @@ model = ViTImageProcessor.from_pretrained('SeyedAli/Food-Image-Classification-VI
|
|
8 |
|
9 |
def FoodClassification(image):
|
10 |
with tempfile.NamedTemporaryFile(suffix=".png") as temp_audio_file:
|
11 |
-
# Copy the contents of the uploaded
|
12 |
temp_image_file.write(open(image, "rb").read())
|
13 |
temp_image_file.flush()
|
14 |
# Load the image file using torchvision
|
15 |
image = read_image(temp_image_file.name)
|
16 |
pipline = pipeline(task="image-classification", model=model)
|
17 |
output=pipline(image, return_tensors='pt')
|
18 |
-
|
19 |
|
20 |
iface = gr.Interface(fn=FoodClassification, inputs="image", outputs="text")
|
21 |
iface.launch(share=False)
|
|
|
8 |
|
9 |
def FoodClassification(image):
|
10 |
with tempfile.NamedTemporaryFile(suffix=".png") as temp_audio_file:
|
11 |
+
# Copy the contents of the uploaded image file to the temporary file
|
12 |
temp_image_file.write(open(image, "rb").read())
|
13 |
temp_image_file.flush()
|
14 |
# Load the image file using torchvision
|
15 |
image = read_image(temp_image_file.name)
|
16 |
pipline = pipeline(task="image-classification", model=model)
|
17 |
output=pipline(image, return_tensors='pt')
|
18 |
+
return output
|
19 |
|
20 |
iface = gr.Interface(fn=FoodClassification, inputs="image", outputs="text")
|
21 |
iface.launch(share=False)
|