Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,6 @@ processors = {
|
|
17 |
"Qwen/Qwen2-VL-7B-Instruct": AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
|
18 |
}
|
19 |
|
20 |
-
DESCRIPTION = "# Qwen2-VL Object Localization Demo"
|
21 |
-
|
22 |
|
23 |
def image_to_base64(image):
|
24 |
buffered = BytesIO()
|
@@ -101,10 +99,18 @@ css = """
|
|
101 |
border: 1px solid #ccc;
|
102 |
}
|
103 |
"""
|
104 |
-
default_system_prompt = "You are a helpfull assistant to detect objects in images. When asked to detect elements based on a description you return bounding boxes for all elements in the form of [xmin, ymin, xmax, ymax] whith the values beeing scaled to 1000 by 1000 pixels. When there are more than one result answer with a list of bounding boxes in the form of [[xmin, ymin, xmax, ymax], [xmin, ymin, xmax, ymax], ...]."
|
105 |
|
106 |
with gr.Blocks(css=css) as demo:
|
107 |
gr.Markdown(DESCRIPTION)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
with gr.Tab(label="Qwen2-VL Input"):
|
109 |
with gr.Row():
|
110 |
with gr.Column():
|
|
|
17 |
"Qwen/Qwen2-VL-7B-Instruct": AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
|
18 |
}
|
19 |
|
|
|
|
|
20 |
|
21 |
def image_to_base64(image):
|
22 |
buffered = BytesIO()
|
|
|
99 |
border: 1px solid #ccc;
|
100 |
}
|
101 |
"""
|
102 |
+
default_system_prompt = "You are a helpfull assistant to detect objects in images. When asked to detect elements based on a description you return bounding boxes for all elements in the form of [xmin, ymin, xmax, ymax] whith the values beeing scaled to 1000 by 1000 pixels. When there are more than one result, answer with a list of bounding boxes in the form of [[xmin, ymin, xmax, ymax], [xmin, ymin, xmax, ymax], ...]."
|
103 |
|
104 |
with gr.Blocks(css=css) as demo:
|
105 |
gr.Markdown(DESCRIPTION)
|
106 |
+
gr.Markdown(
|
107 |
+
"""
|
108 |
+
# Qwen2-VL Object Detection Demo
|
109 |
+
|
110 |
+
Use the Qwen2-VL model to detect objects in an image.
|
111 |
+
|
112 |
+
Usage: Use the keyword "detect" and a description of the target (see examples below).
|
113 |
+
""")
|
114 |
with gr.Tab(label="Qwen2-VL Input"):
|
115 |
with gr.Row():
|
116 |
with gr.Column():
|