Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -76,15 +76,17 @@ def predict(img) :
|
|
76 |
pred = plot_img_bbox(np.array(img), nms_prediction)
|
77 |
|
78 |
#pred = np.array(Image.open("pred.jpg"))
|
|
|
79 |
|
80 |
# Calculate the prediction time
|
81 |
pred_time = round(timer() - start_time, 5)
|
82 |
|
83 |
# Return the prediction dictionary and prediction time
|
84 |
-
return pred
|
85 |
|
86 |
image = gr.components.Image()
|
87 |
out_im = gr.components.Image()
|
|
|
88 |
|
89 |
### 4. Gradio app ###
|
90 |
# Create title, description and article strings
|
@@ -100,7 +102,7 @@ example_list = [["examples/" + example] for example in os.listdir("examples")]
|
|
100 |
# Create the Gradio demo
|
101 |
demo = gr.Interface(fn=predict, # mapping function from input to output
|
102 |
inputs= image, #gr.Image(type="pil"), # what are the inputs?
|
103 |
-
outputs=out_im,
|
104 |
examples=example_list,
|
105 |
title=title,
|
106 |
description=description,
|
|
|
76 |
pred = plot_img_bbox(np.array(img), nms_prediction)
|
77 |
|
78 |
#pred = np.array(Image.open("pred.jpg"))
|
79 |
+
word = "Number of palm trees detected : "+str(len(nms_prediction["boxes"]))
|
80 |
|
81 |
# Calculate the prediction time
|
82 |
pred_time = round(timer() - start_time, 5)
|
83 |
|
84 |
# Return the prediction dictionary and prediction time
|
85 |
+
return pred,word
|
86 |
|
87 |
image = gr.components.Image()
|
88 |
out_im = gr.components.Image()
|
89 |
+
out_lab = gr.components.Label()
|
90 |
|
91 |
### 4. Gradio app ###
|
92 |
# Create title, description and article strings
|
|
|
102 |
# Create the Gradio demo
|
103 |
demo = gr.Interface(fn=predict, # mapping function from input to output
|
104 |
inputs= image, #gr.Image(type="pil"), # what are the inputs?
|
105 |
+
outputs=[out_im,out_lab]
|
106 |
examples=example_list,
|
107 |
title=title,
|
108 |
description=description,
|