# AUTOGENERATED! DO NOT EDIT! File to edit: telecom_object_detection.ipynb.
# %% auto 0
__all__ = ['title', 'css', 'urls', 'flip_text', 'flip_image']
# %% telecom_object_detection.ipynb 2
import gradio as gr
from pathlib import Path
# %% telecom_object_detection.ipynb 4
title = """
Telecom Object Detection with Azure Custom Vision
"""
css = '''
h1#title {
text-align: center;
}
'''
# %% telecom_object_detection.ipynb 5
import numpy as np
import gradio as gr
urls = ["https://c8.alamy.com/comp/J2AB4K/the-new-york-stock-exchange-on-the-wall-street-in-new-york-J2AB4K.jpg"]
def flip_text(): pass
def flip_image(): pass
with gr.Blocks(css=css) as demo:
gr.Markdown(title)
with gr.Tabs():
with gr.TabItem("Image Upload"):
with gr.Row():
image_input = gr.Image()
image_output = gr.Image()
with gr.Row():
"""example_images = gr.Dataset(components=[img_input],
samples=[[path.as_posix()] for path in sorted(Path('images').rglob('*.jpg'))]
)"""
example_images = gr.Examples(
examples=[path.as_posix() for path in sorted(Path('images').rglob('*.jpg'))],
inputs=image_input
)
image_button = gr.Button("Detect")
with gr.TabItem("Image URL"):
with gr.Row():
url_input = gr.Textbox(lines=2, label='Enter valid image URL here..')
img_output_from_url = gr.Image(shape=(650,650))
with gr.Row():
example_url = gr.Dataset(components=[url_input], samples=[[str(url)] for url in urls])
url_button = gr.Button("Detect")
url_button.click(flip_text, inputs=url_input, outputs=img_output_from_url)
image_button.click(flip_image, inputs=image_input, outputs=image_output)
demo.launch()