DHEIVER commited on
Commit
5c84014
·
1 Parent(s): 63dbfda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -13,9 +13,9 @@ classifier = VisionClassifierInference(
13
 
14
  def classify_image(image_file):
15
  """Classify an image using a pre-trained ViT model."""
16
- label = classifier.predict(img_path=image_file.name)
17
  # Add a confidence score to the output
18
- confidence = classifier.predict_proba(img_path=image_file.name)[0][label]
19
 
20
  # Get the PIL Image object for the uploaded image
21
  image = Image.open(image_file)
@@ -33,6 +33,7 @@ def classify_image(image_file):
33
  return output_image, f"Predicted class: {label} (confidence: {confidence:.2f})"
34
 
35
 
 
36
  iface = gr.Interface(
37
  fn=classify_image,
38
  inputs=gr.inputs.Image(type="filepath", label="Upload an image"),
 
13
 
14
  def classify_image(image_file):
15
  """Classify an image using a pre-trained ViT model."""
16
+ label = classifier.predict(img=Image.open(image_file.name))
17
  # Add a confidence score to the output
18
+ confidence = classifier.predict_proba(img=Image.open(image_file.name))[0][label]
19
 
20
  # Get the PIL Image object for the uploaded image
21
  image = Image.open(image_file)
 
33
  return output_image, f"Predicted class: {label} (confidence: {confidence:.2f})"
34
 
35
 
36
+
37
  iface = gr.Interface(
38
  fn=classify_image,
39
  inputs=gr.inputs.Image(type="filepath", label="Upload an image"),