Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,10 +16,11 @@ def predict(img):
|
|
| 16 |
output = onnx_model.run(img, return_prob=True)
|
| 17 |
end_time = time.time()
|
| 18 |
elapsed_time = end_time - start_time
|
| 19 |
-
|
|
|
|
| 20 |
pred_label_and_probs = {"Men" : output[0],"Women" : output[1]}
|
| 21 |
|
| 22 |
-
return pred_label_and_probs,
|
| 23 |
|
| 24 |
onnx_model = Onnx_deploy_model(model_path=model_path, img_size=img_size)
|
| 25 |
|
|
@@ -27,7 +28,7 @@ onnx_model = Onnx_deploy_model(model_path=model_path, img_size=img_size)
|
|
| 27 |
demo = gr.Interface(fn=predict,
|
| 28 |
inputs=gr.Image(type="pil"),
|
| 29 |
outputs=[gr.Label(num_top_classes=2, label="Predictions"),
|
| 30 |
-
gr.Number(label="Prediction
|
| 31 |
title=title,
|
| 32 |
description=description,
|
| 33 |
article=article)
|
|
|
|
| 16 |
output = onnx_model.run(img, return_prob=True)
|
| 17 |
end_time = time.time()
|
| 18 |
elapsed_time = end_time - start_time
|
| 19 |
+
prediction_fps = 1 / elapsed_time
|
| 20 |
+
|
| 21 |
pred_label_and_probs = {"Men" : output[0],"Women" : output[1]}
|
| 22 |
|
| 23 |
+
return pred_label_and_probs, prediction_fps
|
| 24 |
|
| 25 |
onnx_model = Onnx_deploy_model(model_path=model_path, img_size=img_size)
|
| 26 |
|
|
|
|
| 28 |
demo = gr.Interface(fn=predict,
|
| 29 |
inputs=gr.Image(type="pil"),
|
| 30 |
outputs=[gr.Label(num_top_classes=2, label="Predictions"),
|
| 31 |
+
gr.Number(label="Prediction speed(FPS)")],
|
| 32 |
title=title,
|
| 33 |
description=description,
|
| 34 |
article=article)
|