SeyedAli commited on
Commit
e35723c
1 Parent(s): ab4c3a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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)