Tobias Czempiel
commited on
Commit
•
74fe289
1
Parent(s):
6acabc2
workflow stuff
Browse files- runSDSdemo.py +2 -7
runSDSdemo.py
CHANGED
@@ -92,20 +92,15 @@ def predict(input_img):
|
|
92 |
# probabilities of all classes
|
93 |
pred_softmax = torch.softmax(outputs, dim=1).cpu().numpy()[0]
|
94 |
# class with hightest probability
|
95 |
-
pred = torch.argmax(outputs, dim=1).cpu().numpy()
|
96 |
# diagnostic suggestions
|
97 |
-
|
98 |
-
# grad_cam image
|
99 |
-
target_layers = model.features[-1]
|
100 |
-
output_img = image_grad_cam(model,leasion_tensor,input_float_np,target_layers)
|
101 |
# return label dict and suggestion
|
102 |
-
return {classes[i]: float(pred_softmax[i]) for i in range(len(classes))}
|
103 |
|
104 |
# start gradio application
|
105 |
gr.Interface(
|
106 |
fn=predict,
|
107 |
inputs=gr.inputs.Image(),
|
108 |
-
outputs=[gr.outputs.Label(label="Predict Result")
|
109 |
examples=[['images/video01_000014_prep.png'],['images/video01_001403.png'],['images/video01_001528_pack.png']],
|
110 |
title="Surgical Workflow Classifier"
|
111 |
).launch()
|
|
|
92 |
# probabilities of all classes
|
93 |
pred_softmax = torch.softmax(outputs, dim=1).cpu().numpy()[0]
|
94 |
# class with hightest probability
|
|
|
95 |
# diagnostic suggestions
|
|
|
|
|
|
|
|
|
96 |
# return label dict and suggestion
|
97 |
+
return {classes[i]: float(pred_softmax[i]) for i in range(len(classes))}
|
98 |
|
99 |
# start gradio application
|
100 |
gr.Interface(
|
101 |
fn=predict,
|
102 |
inputs=gr.inputs.Image(),
|
103 |
+
outputs=[gr.outputs.Label(label="Predict Result")],
|
104 |
examples=[['images/video01_000014_prep.png'],['images/video01_001403.png'],['images/video01_001528_pack.png']],
|
105 |
title="Surgical Workflow Classifier"
|
106 |
).launch()
|