Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,7 +97,7 @@ def run_example(image, text_input, model_id="OS-Copilot/OS-Atlas-Base-7B"):
|
|
| 97 |
boxes = [[boxes[0][0], boxes[0][1], boxes[1][0], boxes[1][1]]]
|
| 98 |
|
| 99 |
scaled_boxes = rescale_bounding_boxes(boxes, image.width, image.height)
|
| 100 |
-
return object_ref, draw_bounding_boxes(image, scaled_boxes)
|
| 101 |
|
| 102 |
css = """
|
| 103 |
#output {
|
|
@@ -119,6 +119,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 119 |
submit_btn = gr.Button(value="Submit")
|
| 120 |
with gr.Column():
|
| 121 |
model_output_text = gr.Textbox(label="Model Output Text")
|
|
|
|
| 122 |
annotated_image = gr.Image(label="Annotated Image")
|
| 123 |
|
| 124 |
gr.Examples(
|
|
@@ -127,12 +128,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 127 |
["assets/web_6f93090a-81f6-489e-bb35-1a2838b18c01.png", "switch to discussions"],
|
| 128 |
],
|
| 129 |
inputs=[input_img, text_input],
|
| 130 |
-
outputs=[model_output_text, annotated_image],
|
| 131 |
fn=run_example,
|
| 132 |
cache_examples=True,
|
| 133 |
label="Try examples"
|
| 134 |
)
|
| 135 |
|
| 136 |
-
submit_btn.click(run_example, [input_img, text_input, model_selector], [model_output_text, annotated_image])
|
| 137 |
|
| 138 |
demo.launch(debug=True)
|
|
|
|
| 97 |
boxes = [[boxes[0][0], boxes[0][1], boxes[1][0], boxes[1][1]]]
|
| 98 |
|
| 99 |
scaled_boxes = rescale_bounding_boxes(boxes, image.width, image.height)
|
| 100 |
+
return object_ref, scaled_boxes, draw_bounding_boxes(image, scaled_boxes)
|
| 101 |
|
| 102 |
css = """
|
| 103 |
#output {
|
|
|
|
| 119 |
submit_btn = gr.Button(value="Submit")
|
| 120 |
with gr.Column():
|
| 121 |
model_output_text = gr.Textbox(label="Model Output Text")
|
| 122 |
+
model_output_box = gr.Textbox(label="Model Output Box")
|
| 123 |
annotated_image = gr.Image(label="Annotated Image")
|
| 124 |
|
| 125 |
gr.Examples(
|
|
|
|
| 128 |
["assets/web_6f93090a-81f6-489e-bb35-1a2838b18c01.png", "switch to discussions"],
|
| 129 |
],
|
| 130 |
inputs=[input_img, text_input],
|
| 131 |
+
outputs=[model_output_text, model_output_box, annotated_image],
|
| 132 |
fn=run_example,
|
| 133 |
cache_examples=True,
|
| 134 |
label="Try examples"
|
| 135 |
)
|
| 136 |
|
| 137 |
+
submit_btn.click(run_example, [input_img, text_input, model_selector], [model_output_text, model_output_box, annotated_image])
|
| 138 |
|
| 139 |
demo.launch(debug=True)
|