Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,9 @@ model = ViTImageProcessor.from_pretrained('SeyedAli/Food-Image-Classification-VI
|
|
10 |
def FoodClassification(image):
|
11 |
with tempfile.NamedTemporaryFile(suffix=".png") as temp_image_file:
|
12 |
# Copy the contents of the uploaded image file to the temporary file
|
13 |
-
temp_image_file.write(open(image, "rb").read())
|
14 |
-
temp_image_file.flush()
|
|
|
15 |
# Load the image file using torchvision
|
16 |
image = read_image(temp_image_file.name)
|
17 |
pipline = pipeline(task="image-classification", model=model)
|
|
|
10 |
def FoodClassification(image):
|
11 |
with tempfile.NamedTemporaryFile(suffix=".png") as temp_image_file:
|
12 |
# Copy the contents of the uploaded image file to the temporary file
|
13 |
+
# temp_image_file.write(open(image, "rb").read())
|
14 |
+
# temp_image_file.flush()
|
15 |
+
Image.fromarray(image).save(temp_image_file.name)
|
16 |
# Load the image file using torchvision
|
17 |
image = read_image(temp_image_file.name)
|
18 |
pipline = pipeline(task="image-classification", model=model)
|