Update app.py
Browse files
app.py
CHANGED
@@ -125,53 +125,55 @@ h1#title {
|
|
125 |
demo = gr.Blocks(css=css)
|
126 |
|
127 |
with demo:
|
128 |
-
gr.
|
129 |
-
gr.Markdown(description)
|
130 |
-
gr.Markdown(twitter_link)
|
131 |
-
options = gr.Dropdown(choices=models,label='Object Detection Model',show_label=True)
|
132 |
-
slider_input = gr.Slider(minimum=0.2,maximum=1,value=0.5,step=0.1,label='Prediction Threshold')
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
152 |
|
153 |
-
with gr.
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
cam_but = gr.Button('Detect')
|
166 |
-
|
167 |
-
url_but.click(detect_objects,inputs=[options,url_input,img_input,web_input,slider_input],outputs=[img_output_from_url],queue=True)
|
168 |
-
img_but.click(detect_objects,inputs=[options,url_input,img_input,web_input,slider_input],outputs=[img_output_from_upload],queue=True)
|
169 |
-
cam_but.click(detect_objects,inputs=[options,url_input,img_input,web_input,slider_input],outputs=[img_output_from_webcam],queue=True)
|
170 |
-
example_images.click(fn=set_example_image,inputs=[example_images],outputs=[img_input])
|
171 |
-
example_url.click(fn=set_example_url,inputs=[example_url],outputs=[url_input,original_image])
|
172 |
|
173 |
-
|
174 |
-
gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=nickmuchi-face-mask-detections-with-yolos)")
|
175 |
|
176 |
|
177 |
demo.launch(debug=True,enable_queue=True)
|
|
|
125 |
demo = gr.Blocks(css=css)
|
126 |
|
127 |
with demo:
|
128 |
+
with gr.Box():
|
|
|
|
|
|
|
|
|
129 |
|
130 |
+
gr.Markdown(title)
|
131 |
+
gr.Markdown(description)
|
132 |
+
gr.Markdown(twitter_link)
|
133 |
+
options = gr.Dropdown(choices=models,label='Object Detection Model',show_label=True)
|
134 |
+
slider_input = gr.Slider(minimum=0.2,maximum=1,value=0.5,step=0.1,label='Prediction Threshold')
|
135 |
+
|
136 |
+
with gr.Tabs():
|
137 |
+
with gr.TabItem('Image URL'):
|
138 |
+
with gr.Row():
|
139 |
+
with gr.Column():
|
140 |
+
url_input = gr.Textbox(lines=2,label='Enter valid image URL here..')
|
141 |
+
original_image = gr.Image(shape=(750,750))
|
142 |
+
with gr.Column():
|
143 |
+
img_output_from_url = gr.Image(shape=(750,750))
|
144 |
+
|
145 |
+
with gr.Row():
|
146 |
+
example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
|
147 |
|
148 |
+
url_but = gr.Button('Detect')
|
149 |
+
|
150 |
+
with gr.TabItem('Image Upload'):
|
151 |
+
with gr.Row():
|
152 |
+
img_input = gr.Image(type='pil',shape=(750,750))
|
153 |
+
img_output_from_upload= gr.Image(shape=(750,750))
|
154 |
+
|
155 |
+
with gr.Row():
|
156 |
+
example_images = gr.Dataset(components=[img_input],
|
157 |
+
samples=[[path.as_posix()] for path in sorted(pathlib.Path('images').rglob('*.j*g'))])
|
158 |
+
|
159 |
+
|
160 |
+
img_but = gr.Button('Detect')
|
161 |
|
162 |
+
with gr.TabItem('WebCam'):
|
163 |
+
with gr.Row():
|
164 |
+
web_input = gr.Image(source='webcam',type='pil',shape=(750,750),streaming=True)
|
165 |
+
img_output_from_webcam= gr.Image(shape=(750,750))
|
166 |
+
|
167 |
+
cam_but = gr.Button('Detect')
|
168 |
|
169 |
+
url_but.click(detect_objects,inputs=[options,url_input,img_input,web_input,slider_input],outputs=[img_output_from_url],queue=True)
|
170 |
+
img_but.click(detect_objects,inputs=[options,url_input,img_input,web_input,slider_input],outputs=[img_output_from_upload],queue=True)
|
171 |
+
cam_but.click(detect_objects,inputs=[options,url_input,img_input,web_input,slider_input],outputs=[img_output_from_webcam],queue=True)
|
172 |
+
example_images.click(fn=set_example_image,inputs=[example_images],outputs=[img_input])
|
173 |
+
example_url.click(fn=set_example_url,inputs=[example_url],outputs=[url_input,original_image])
|
174 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
+
gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=nickmuchi-face-mask-detections-with-yolos)")
|
|
|
177 |
|
178 |
|
179 |
demo.launch(debug=True,enable_queue=True)
|