Spaces:
Runtime error
Runtime error
Update2 app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
@@ -21,6 +21,12 @@ urls = ["https://c8.alamy.com/comp/J2AB4K/the-new-york-stock-exchange-on-the-wal
|
|
21 |
|
22 |
demo = gr.Blocks(css=css)
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
with demo:
|
25 |
gr.Markdown(title)
|
26 |
|
@@ -32,11 +38,10 @@ with demo:
|
|
32 |
img_output_from_upload= gr.Image(shape=(650,650))
|
33 |
|
34 |
with gr.Row():
|
35 |
-
example_images = gr.Dataset(
|
36 |
-
|
37 |
-
samples=[[path.as_posix()] for path in sorted(Path('images').rglob('*.JPG'))]
|
38 |
)
|
39 |
-
|
40 |
|
41 |
with gr.TabItem('Image URL'):
|
42 |
with gr.Row():
|
@@ -47,5 +52,10 @@ with demo:
|
|
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)
|
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: telecom_object_detection.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
+
__all__ = ['title', 'css', 'urls', 'demo', 'set_example_url', 'set_example_image']
|
5 |
|
6 |
# %% telecom_object_detection.ipynb 2
|
7 |
import gradio as gr
|
|
|
21 |
|
22 |
demo = gr.Blocks(css=css)
|
23 |
|
24 |
+
def set_example_url(example: list) -> dict:
|
25 |
+
return gr.Textbox.update(value=example[0])
|
26 |
+
|
27 |
+
def set_example_image(example: list) -> dict:
|
28 |
+
return gr.Image.update(value=example[0])
|
29 |
+
|
30 |
with demo:
|
31 |
gr.Markdown(title)
|
32 |
|
|
|
38 |
img_output_from_upload= gr.Image(shape=(650,650))
|
39 |
|
40 |
with gr.Row():
|
41 |
+
example_images = gr.Dataset(components=[img_input],
|
42 |
+
samples=[[path.as_posix()] for path in sorted(Path('images').rglob('*.jpg'))]
|
|
|
43 |
)
|
44 |
+
img_but = gr.Button('Detect')
|
45 |
|
46 |
with gr.TabItem('Image URL'):
|
47 |
with gr.Row():
|
|
|
52 |
example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
|
53 |
|
54 |
url_but = gr.Button('Detect')
|
55 |
+
|
56 |
+
#url_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=img_output_from_url,queue=True)
|
57 |
+
#img_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=img_output_from_upload,queue=True)
|
58 |
+
example_images.click(fn=set_example_image,inputs=[example_images],outputs=[img_input])
|
59 |
+
example_url.click(fn=set_example_url,inputs=[example_url],outputs=[url_input])
|
60 |
|
61 |
demo.launch(enable_queue=True)
|