Nicole-M commited on
Commit
5d091a0
·
verified ·
1 Parent(s): 11126b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -9,12 +9,12 @@ clf = pipeline(model=model, task="image-classification", image_processor=image_p
9
  class_names = ['Benign', 'Malignant']
10
 
11
  def predict_image(img):
12
- img=img.reshape(224,224,3)
13
  img = transforms.ToPILImage()(img)
 
14
  prediction=clf.predict(img)
15
  return {class_names[i]: float(prediction[i]["score"]) for i in range(2)}
16
 
17
- image = gr.Image(shape=(224,224))
18
  label = gr.Label(num_top_classes=2)
19
 
20
- gr.Interface(fn=predict_image, inputs=image, outputs=label, interpretation='default', title="Mammogram classification").launch()
 
9
  class_names = ['Benign', 'Malignant']
10
 
11
  def predict_image(img):
 
12
  img = transforms.ToPILImage()(img)
13
+ img = transforms.Resize((224,224))(img)
14
  prediction=clf.predict(img)
15
  return {class_names[i]: float(prediction[i]["score"]) for i in range(2)}
16
 
17
+ image = gr.Image(label="Select a mammogram image", sources=['upload'])
18
  label = gr.Label(num_top_classes=2)
19
 
20
+ gr.Interface(fn=predict_image, inputs=image, outputs=label, title="Mammogram classification").launch(debug='True')