PedroMartelleto commited on
Commit
19010f0
1 Parent(s): 78b0316

Deploying to HF

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -115,13 +115,7 @@ def create_model_from_checkpoint():
115
  model = create_model_from_checkpoint()
116
  labels = [ "benign", "malignant", "normal" ]
117
 
118
- def predict(gr_inputs):
119
- img = gr_inputs[0]
120
- shap_samples = gr_inputs[1]
121
- shap_stdevs = gr_inputs[2]
122
- occlusion_stride = gr_inputs[3]
123
- occlusion_window = gr_inputs[4]
124
-
125
  explainer = Explainer(model, img, labels)
126
  return [explainer.confidences,
127
  explainer.shap(shap_samples, shap_stdevs),
@@ -137,5 +131,10 @@ ui = gr.Interface(fn=predict,
137
  gr.Slider(minimum=4, maximum=80, default=15, label="Occlusion Window", step=1)
138
  ],
139
  outputs=[gr.Label(num_top_classes=3), gr.Image(type="pil"), gr.Image(type="pil"), gr.Image(type="pil")],
140
- examples=["benign (52).png", "benign (243).png", "malignant (127).png", "malignant (201).png", "normal (81).png", "normal (101).png"]).launch()
 
 
 
 
 
141
  ui.launch(share=True)
 
115
  model = create_model_from_checkpoint()
116
  labels = [ "benign", "malignant", "normal" ]
117
 
118
+ def predict(img, shap_samples, shap_stdevs, occlusion_stride, occlusion_window):
 
 
 
 
 
 
119
  explainer = Explainer(model, img, labels)
120
  return [explainer.confidences,
121
  explainer.shap(shap_samples, shap_stdevs),
 
131
  gr.Slider(minimum=4, maximum=80, default=15, label="Occlusion Window", step=1)
132
  ],
133
  outputs=[gr.Label(num_top_classes=3), gr.Image(type="pil"), gr.Image(type="pil"), gr.Image(type="pil")],
134
+ examples=[["benign (52).png", 50, 0.0001, 8, 15],
135
+ ["benign (243).png", 50, 0.0001, 8, 15],
136
+ ["malignant (127).png", 50, 0.0001, 8, 15],
137
+ ["malignant (201).png", 50, 0.0001, 8, 15],
138
+ ["normal (81).png", 50, 0.0001, 8, 15],
139
+ ["normal (101).png", 50, 0.0001, 8, 15]]).launch()
140
  ui.launch(share=True)