added demo + examples images
Browse files
IMG_1.jpg
ADDED
|
IMG_2.jpg
ADDED
|
IMG_3.jpg
ADDED
|
app.py
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
return
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
def flip_image(x):
|
| 5 |
+
return (1000, np.zeros((100, 100))
|
| 6 |
|
| 7 |
+
with gr.Blocks() as demo:
|
| 8 |
+
gr.Markdown("""
|
| 9 |
+
# Crowd Counting based on SASNet
|
| 10 |
+
|
| 11 |
+
We implemented a image crowd counting model with VGG16 following the paper of Song et. al (2021).
|
| 12 |
+
|
| 13 |
+
## References
|
| 14 |
+
Song, Q., Wang, C., Wang, Y., Tai, Y., Wang, C., Li, J., … Ma, J. (2021). To Choose or to Fuse? Scale Selection for Crowd Counting. The Thirty-Fifth AAAI Conference on Artificial Intelligence (AAAI-21).
|
| 15 |
+
""")
|
| 16 |
+
image_button = gr.Button("Count the Crowd!")
|
| 17 |
+
with gr.Row():
|
| 18 |
+
with gr.Column():
|
| 19 |
+
image_input = gr.Image(type="pil")
|
| 20 |
+
gr.Examples(["IMG_1.jpg", "IMG_2.jpg", "IMG_3.jpg"], image_input)
|
| 21 |
+
with gr.Column():
|
| 22 |
+
image_output = gr.Image()
|
| 23 |
+
text_output = gr.Label()
|
| 24 |
+
|
| 25 |
+
image_button.click(flip_image, inputs=image_input, outputs=[text_output, image_output])
|
| 26 |
+
|
| 27 |
+
demo.launch()
|