Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ def load_and_prep_imgg(img : Image.Image, img_shape=224, scale=True):
|
|
46 |
else:
|
47 |
return img
|
48 |
|
49 |
-
def predict(img) -> Tuple[Dict,float] :
|
50 |
|
51 |
start_time = timer()
|
52 |
|
@@ -63,7 +63,7 @@ def predict(img) -> Tuple[Dict,float] :
|
|
63 |
end_time = timer()
|
64 |
pred_time = round(end_time - start_time , 4)
|
65 |
|
66 |
-
return pred_class , pred_time
|
67 |
|
68 |
### 4. Gradio app - our Gradio interface + launch command
|
69 |
|
@@ -79,6 +79,7 @@ example_list
|
|
79 |
demo = gr.Interface(fn=predict ,
|
80 |
inputs=gr.Image(type='pil'),
|
81 |
outputs=[gr.Label(num_top_classes = 3 , label= 'prediction'),
|
|
|
82 |
gr.Number(label= 'Prediction time (s)')],
|
83 |
examples = example_list,
|
84 |
title = title,
|
|
|
46 |
else:
|
47 |
return img
|
48 |
|
49 |
+
def predict(img) -> Tuple[Dict,float,float] :
|
50 |
|
51 |
start_time = timer()
|
52 |
|
|
|
63 |
end_time = timer()
|
64 |
pred_time = round(end_time - start_time , 4)
|
65 |
|
66 |
+
return pred_class , pred_img.max() , pred_time
|
67 |
|
68 |
### 4. Gradio app - our Gradio interface + launch command
|
69 |
|
|
|
79 |
demo = gr.Interface(fn=predict ,
|
80 |
inputs=gr.Image(type='pil'),
|
81 |
outputs=[gr.Label(num_top_classes = 3 , label= 'prediction'),
|
82 |
+
gr.Number(label= 'Prediction Probabilities'),
|
83 |
gr.Number(label= 'Prediction time (s)')],
|
84 |
examples = example_list,
|
85 |
title = title,
|