Spaces:
Runtime error
Runtime error
File size: 2,015 Bytes
5e06ef0 6916ee6 5e06ef0 c943497 5e06ef0 1fabc95 5e06ef0 1fabc95 c943497 6916ee6 1fabc95 c943497 1fabc95 c943497 1fabc95 c943497 1fabc95 4e2ce6e 1fabc95 c943497 1fabc95 c943497 2fe9acc c943497 2fe9acc 6916ee6 c943497 6916ee6 1fabc95 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# 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 = """<h1 id="title">Telecom Object Detection with Azure Custom Vision</h1>"""
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()
|