Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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(
|
18 |
label = gr.Label(num_top_classes=2)
|
19 |
|
20 |
-
gr.Interface(fn=predict_image, inputs=image, outputs=label,
|
|
|
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')
|