Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: telecom_object_detection.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
-
__all__ = ['title', 'css', '
|
5 |
|
6 |
# %% telecom_object_detection.ipynb 2
|
7 |
import gradio as gr
|
|
|
8 |
|
9 |
# %% telecom_object_detection.ipynb 4
|
10 |
title = """<h1 id="title">Telecom Object Detection with Azure Custom Vision</h1>"""
|
@@ -15,9 +16,36 @@ h1#title {
|
|
15 |
}
|
16 |
'''
|
17 |
|
18 |
-
# %% telecom_object_detection.ipynb
|
19 |
-
|
20 |
-
return "Hello " + name + "!!"
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: telecom_object_detection.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
+
__all__ = ['title', 'css', 'urls', 'demo']
|
5 |
|
6 |
# %% telecom_object_detection.ipynb 2
|
7 |
import gradio as gr
|
8 |
+
from pathlib import Path
|
9 |
|
10 |
# %% telecom_object_detection.ipynb 4
|
11 |
title = """<h1 id="title">Telecom Object Detection with Azure Custom Vision</h1>"""
|
|
|
16 |
}
|
17 |
'''
|
18 |
|
19 |
+
# %% telecom_object_detection.ipynb 8
|
20 |
+
urls = ["https://c8.alamy.com/comp/J2AB4K/the-new-york-stock-exchange-on-the-wall-street-in-new-york-J2AB4K.jpg"]
|
|
|
21 |
|
22 |
+
demo = gr.Blocks(css=css)
|
23 |
+
|
24 |
+
with demo:
|
25 |
+
gr.Markdown(title)
|
26 |
+
|
27 |
+
with gr.Tabs():
|
28 |
+
|
29 |
+
with gr.TabItem('Image Upload'):
|
30 |
+
with gr.Row():
|
31 |
+
img_input = gr.Image(type='pil')
|
32 |
+
img_output_from_upload= gr.Image(shape=(650,650))
|
33 |
+
|
34 |
+
with gr.Row():
|
35 |
+
example_images = gr.Dataset(
|
36 |
+
components=[img_input],
|
37 |
+
samples=[[path.as_posix()] for path in sorted(Path('images').rglob('*.JPG'))]
|
38 |
+
)
|
39 |
+
url_but = gr.Button('Detect')
|
40 |
+
|
41 |
+
with gr.TabItem('Image URL'):
|
42 |
+
with gr.Row():
|
43 |
+
url_input = gr.Textbox(lines=2, label='Enter valid image URL here..')
|
44 |
+
img_output_from_url = gr.Image(shape=(650,650))
|
45 |
+
|
46 |
+
with gr.Row():
|
47 |
+
example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
|
48 |
+
|
49 |
+
url_but = gr.Button('Detect')
|
50 |
+
|
51 |
+
demo.launch(enable_queue=True)
|