Spaces:
Build error
Build error
Commit
·
ff19e29
1
Parent(s):
008ff9d
add examples
Browse files
app.py
CHANGED
|
@@ -75,6 +75,12 @@ def process(
|
|
| 75 |
parsed_content_list = '\n'.join(parsed_content_list)
|
| 76 |
return image, str(parsed_content_list)
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
with gr.Blocks() as demo:
|
|
@@ -95,6 +101,15 @@ with gr.Blocks() as demo:
|
|
| 95 |
image_output_component = gr.Image(type='pil', label='Image Output')
|
| 96 |
text_output_component = gr.Textbox(label='Parsed screen elements', placeholder='Text Output')
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
submit_button_component.click(
|
| 99 |
fn=process,
|
| 100 |
inputs=[
|
|
|
|
| 75 |
parsed_content_list = '\n'.join(parsed_content_list)
|
| 76 |
return image, str(parsed_content_list)
|
| 77 |
|
| 78 |
+
examples = [
|
| 79 |
+
["./imgs/google_page.png", 0.05, 0.1],
|
| 80 |
+
["./imgs/logo.png", 0.2, 0.15],
|
| 81 |
+
["./imgs/windows_home.png", 0.1, 0.05],
|
| 82 |
+
["./imgs/windows_multitab.png", 0.1, 0.05]
|
| 83 |
+
]
|
| 84 |
|
| 85 |
|
| 86 |
with gr.Blocks() as demo:
|
|
|
|
| 101 |
image_output_component = gr.Image(type='pil', label='Image Output')
|
| 102 |
text_output_component = gr.Textbox(label='Parsed screen elements', placeholder='Text Output')
|
| 103 |
|
| 104 |
+
gr.Examples(
|
| 105 |
+
examples=examples,
|
| 106 |
+
inputs=[image_input_component],
|
| 107 |
+
outputs=[image_output_component, text_output_component],
|
| 108 |
+
fn=process, # Function to execute
|
| 109 |
+
cache_examples="lazy" # Enables lazy caching for examples
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
submit_button_component.click(
|
| 114 |
fn=process,
|
| 115 |
inputs=[
|
imgs/saved_image_demo.png
CHANGED
|
|
util/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (124 Bytes). View file
|
|
|
util/__pycache__/box_annotator.cpython-310.pyc
ADDED
|
Binary file (6.62 kB). View file
|
|
|