Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -86,11 +86,18 @@ def predict_count(input_image):
|
|
86 |
predicted_count = int(output.detach().cpu().sum().numpy())
|
87 |
density_map = output.detach().cpu().numpy().reshape(output.shape[2], output.shape[3])
|
88 |
density_map_color = plt.cm.jet(density_map / np.max(density_map))
|
|
|
89 |
return predicted_count, density_map_color
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
|
94 |
-
grapp = gr.Interface(fn=predict_count, inputs=input_interface, outputs=[output_interface, density_map_interface])
|
95 |
# Launch the app
|
96 |
grapp.launch()
|
|
|
86 |
predicted_count = int(output.detach().cpu().sum().numpy())
|
87 |
density_map = output.detach().cpu().numpy().reshape(output.shape[2], output.shape[3])
|
88 |
density_map_color = plt.cm.jet(density_map / np.max(density_map))
|
89 |
+
|
90 |
return predicted_count, density_map_color
|
91 |
+
from gradio.inputs import Image
|
92 |
+
from gradio.outputs import Label, Image
|
93 |
+
input_interface = gr.inputs.Image(label="Input Image")
|
94 |
+
output_interface = [
|
95 |
+
Label(label="Predicted Count"),
|
96 |
+
Image(label="Density Map", type="numpy")
|
97 |
+
]
|
98 |
|
99 |
+
# Create the Gradio app with both interfaces
|
100 |
+
grapp = gr.Interface(fn=predict_count, inputs=input_interface, outputs=output_interface)
|
101 |
|
|
|
102 |
# Launch the app
|
103 |
grapp.launch()
|