Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,9 +65,9 @@ def run_example(image, text_input, model_id="Qwen/Qwen2-VL-7B-Instruct"):
|
|
| 65 |
)
|
| 66 |
|
| 67 |
pattern = r'\[\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\]'
|
| 68 |
-
matches = re.findall(pattern, output_text)
|
| 69 |
-
|
| 70 |
-
return
|
| 71 |
|
| 72 |
css = """
|
| 73 |
#output {
|
|
@@ -87,8 +87,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 87 |
text_input = gr.Textbox(label="Description of Localization Target")
|
| 88 |
submit_btn = gr.Button(value="Submit")
|
| 89 |
with gr.Column():
|
| 90 |
-
|
|
|
|
| 91 |
|
| 92 |
-
submit_btn.click(run_example, [input_img, text_input, model_selector], [
|
| 93 |
|
| 94 |
demo.launch(debug=True)
|
|
|
|
| 65 |
)
|
| 66 |
|
| 67 |
pattern = r'\[\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\]'
|
| 68 |
+
matches = re.findall(pattern, str(output_text))
|
| 69 |
+
parsed_boxes = [[int(num) for num in match] for match in matches]
|
| 70 |
+
return output_text, parsed_boxes
|
| 71 |
|
| 72 |
css = """
|
| 73 |
#output {
|
|
|
|
| 87 |
text_input = gr.Textbox(label="Description of Localization Target")
|
| 88 |
submit_btn = gr.Button(value="Submit")
|
| 89 |
with gr.Column():
|
| 90 |
+
model_output_text = gr.Textbox(label="Model Output Text")
|
| 91 |
+
parsed_boxes = gr.Textbox(label="Parsed Boxes")
|
| 92 |
|
| 93 |
+
submit_btn.click(run_example, [input_img, text_input, model_selector], [model_output_text, parsed_boxes])
|
| 94 |
|
| 95 |
demo.launch(debug=True)
|