Spaces:
Running on Zero
Running on Zero
Restore exact original purple and lime palette
Browse filesRestore the original paper.css, original.css and studio.css without modification, with the original sidebar brand and layout. Keep Chinese UI, all 22 cases and the pinned GroundingPI account model. Local 51 tests and release asset fingerprint pass.
- README.md +2 -2
- app.py +28 -12
- docs/ui_case_pool_22_lock.json +1 -1
README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
---
|
| 2 |
title: GroundingPI 视觉感知工作台
|
| 3 |
emoji: 🎯
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.49.1
|
|
@@ -14,7 +14,7 @@ models:
|
|
| 14 |
|
| 15 |
# GroundingPI · 视觉感知工作台
|
| 16 |
|
| 17 |
-
中文视觉感知 demo。支持目标检测、密集检测、描述定位、三类点定位、视觉提示、OCR 与 GUI 定位,共 9 类任务、22 张原始案例。
|
| 18 |
|
| 19 |
模型固定为公开的 `GroundingPI/GroundingPI`,修订版本为 `127b0e1c54c68f24bf769a80067521b815b695dd`。保留模型原生处理器、聊天模板和 GAM 输出协议,中文 OCR 标签使用随项目打包的 Noto Sans CJK。
|
| 20 |
|
|
|
|
| 1 |
---
|
| 2 |
title: GroundingPI 视觉感知工作台
|
| 3 |
emoji: 🎯
|
| 4 |
+
colorFrom: purple
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.49.1
|
|
|
|
| 14 |
|
| 15 |
# GroundingPI · 视觉感知工作台
|
| 16 |
|
| 17 |
+
沿用原版紫色与黄绿色配色、浅紫背景和双栏布局的中文视觉感知 demo。支持目标检测、密集检测、描述定位、三类点定位、视觉提示、OCR 与 GUI 定位,共 9 类任务、22 张原始案例。
|
| 18 |
|
| 19 |
模型固定为公开的 `GroundingPI/GroundingPI`,修订版本为 `127b0e1c54c68f24bf769a80067521b815b695dd`。保留模型原生处理器、聊天模板和 GAM 输出协议,中文 OCR 标签使用随项目打包的 Noto Sans CJK。
|
| 20 |
|
app.py
CHANGED
|
@@ -278,10 +278,22 @@ def service_status():
|
|
| 278 |
)
|
| 279 |
|
| 280 |
|
| 281 |
-
CSS = (ROOT / "assets" / "
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
</style>"""
|
| 286 |
JS = (ROOT / "assets" / "console.js").read_text(encoding="utf-8")
|
| 287 |
first_route = "grounding"
|
|
@@ -292,16 +304,20 @@ with gr.Blocks(
|
|
| 292 |
js=JS,
|
| 293 |
head=HOST_HEAD,
|
| 294 |
title="GroundingPI · 视觉感知工作台",
|
| 295 |
-
theme=gr.themes.
|
| 296 |
analytics_enabled=False,
|
| 297 |
) as demo:
|
| 298 |
image_state = gr.State(str(ROOT / first_case["image"]))
|
| 299 |
case_state = gr.State(first_case["id"])
|
| 300 |
-
gr.Markdown("# GroundingPI\n视觉定位、文字识别与交互目标探索 · 9 类任务 / 22 张案例")
|
| 301 |
with gr.Column(elem_id="console"):
|
| 302 |
with gr.Row(elem_id="workspace-top", equal_height=True):
|
| 303 |
with gr.Column(scale=3, min_width=280, elem_id="controls"):
|
| 304 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
with gr.Column(elem_id="control-settings"):
|
| 306 |
with gr.Row(elem_id="control-fields"):
|
| 307 |
gr.HTML(
|
|
@@ -351,7 +367,7 @@ with gr.Blocks(
|
|
| 351 |
type="filepath",
|
| 352 |
interactive=False,
|
| 353 |
show_label=False,
|
| 354 |
-
height=
|
| 355 |
elem_id="stage-image",
|
| 356 |
show_download_button=False,
|
| 357 |
show_share_button=False,
|
|
@@ -379,7 +395,7 @@ with gr.Blocks(
|
|
| 379 |
query = gr.Textbox(
|
| 380 |
value=query_from_prompt(first_case["prompt"], first_route),
|
| 381 |
label="描述你的目标",
|
| 382 |
-
show_label=
|
| 383 |
lines=2,
|
| 384 |
max_lines=4,
|
| 385 |
placeholder=TASK_HELP[first_route][3],
|
|
@@ -392,13 +408,13 @@ with gr.Blocks(
|
|
| 392 |
with gr.Row(elem_id="review-row", equal_height=True):
|
| 393 |
with gr.Column(scale=4, min_width=320, elem_id="sandbox-panel"):
|
| 394 |
gr.HTML(
|
| 395 |
-
"<div class='film-heading'><h2>
|
| 396 |
)
|
| 397 |
gallery = gr.Gallery(
|
| 398 |
value=gallery_items(first_route),
|
| 399 |
columns=3,
|
| 400 |
rows=1,
|
| 401 |
-
height=
|
| 402 |
show_label=False,
|
| 403 |
allow_preview=False,
|
| 404 |
object_fit="cover",
|
|
@@ -411,7 +427,7 @@ with gr.Blocks(
|
|
| 411 |
with gr.Column(scale=6, min_width=420, elem_id="review-summary"):
|
| 412 |
with gr.Row(elem_id="result-columns", equal_height=True):
|
| 413 |
with gr.Column(scale=4, min_width=200, elem_id="metrics-panel"):
|
| 414 |
-
gr.
|
| 415 |
metrics = gr.HTML(metrics_html(ROUTE_META[first_route][0]))
|
| 416 |
with gr.Column(scale=6, min_width=240, elem_id="sidebar"):
|
| 417 |
gr.HTML(
|
|
|
|
| 278 |
)
|
| 279 |
|
| 280 |
|
| 281 |
+
CSS = (ROOT / "assets" / "paper.css").read_text(encoding="utf-8")
|
| 282 |
+
CSS += "\n" + (ROOT / "assets" / "original.css").read_text(encoding="utf-8")
|
| 283 |
+
CSS += "\n" + (ROOT / "assets" / "studio.css").read_text(encoding="utf-8")
|
| 284 |
+
CSS = CSS.replace(
|
| 285 |
+
"__MANROPE_DATA__",
|
| 286 |
+
base64.b64encode((ROOT / "assets" / "Manrope-variable.ttf").read_bytes()).decode(),
|
| 287 |
+
)
|
| 288 |
+
# Gradio 5 scopes css= rules inside .contain, including media-query selectors.
|
| 289 |
+
# Host sizing must live in head; workbench styling remains scoped.
|
| 290 |
+
HOST_HEAD = """<style id="grounding-host-layout">
|
| 291 |
+
gradio-app:has(#console) .gradio-container { width:100%!important; max-width:1440px!important; min-width:0!important; box-sizing:border-box; overflow:clip!important; padding:28px 32px 32px!important; margin:0 auto!important; }
|
| 292 |
+
gradio-app:has(#console) .gradio-container>main { width:100%!important; max-width:none!important; min-width:0!important; padding:0!important; }
|
| 293 |
+
gradio-app:has(#console) .gradio-container .contain { max-width:none!important; }
|
| 294 |
+
gradio-app:has(#console) footer:not(.studio-footer) { display:none!important; }
|
| 295 |
+
@media(max-width:760px) { gradio-app:has(#console) .gradio-container { padding:16px 14px!important; } }
|
| 296 |
+
@media(max-width:430px) { gradio-app:has(#console) .gradio-container { padding:12px 10px!important; } }
|
| 297 |
</style>"""
|
| 298 |
JS = (ROOT / "assets" / "console.js").read_text(encoding="utf-8")
|
| 299 |
first_route = "grounding"
|
|
|
|
| 304 |
js=JS,
|
| 305 |
head=HOST_HEAD,
|
| 306 |
title="GroundingPI · 视觉感知工作台",
|
| 307 |
+
theme=gr.themes.Base(font=["Manrope", "sans-serif"], font_mono=["ui-monospace", "monospace"]),
|
| 308 |
analytics_enabled=False,
|
| 309 |
) as demo:
|
| 310 |
image_state = gr.State(str(ROOT / first_case["image"]))
|
| 311 |
case_state = gr.State(first_case["id"])
|
|
|
|
| 312 |
with gr.Column(elem_id="console"):
|
| 313 |
with gr.Row(elem_id="workspace-top", equal_height=True):
|
| 314 |
with gr.Column(scale=3, min_width=280, elem_id="controls"):
|
| 315 |
+
gr.HTML(
|
| 316 |
+
"""<div class="control-brand">
|
| 317 |
+
<h2>Grounding<span>PI</span></h2>
|
| 318 |
+
<p>面向物理智能的视觉基元。</p>
|
| 319 |
+
</div>"""
|
| 320 |
+
)
|
| 321 |
with gr.Column(elem_id="control-settings"):
|
| 322 |
with gr.Row(elem_id="control-fields"):
|
| 323 |
gr.HTML(
|
|
|
|
| 367 |
type="filepath",
|
| 368 |
interactive=False,
|
| 369 |
show_label=False,
|
| 370 |
+
height=400,
|
| 371 |
elem_id="stage-image",
|
| 372 |
show_download_button=False,
|
| 373 |
show_share_button=False,
|
|
|
|
| 395 |
query = gr.Textbox(
|
| 396 |
value=query_from_prompt(first_case["prompt"], first_route),
|
| 397 |
label="描述你的目标",
|
| 398 |
+
show_label=False,
|
| 399 |
lines=2,
|
| 400 |
max_lines=4,
|
| 401 |
placeholder=TASK_HELP[first_route][3],
|
|
|
|
| 408 |
with gr.Row(elem_id="review-row", equal_height=True):
|
| 409 |
with gr.Column(scale=4, min_width=320, elem_id="sandbox-panel"):
|
| 410 |
gr.HTML(
|
| 411 |
+
"<div class='film-heading'><h2>探索案例</h2><small>精选视觉场景</small></div>"
|
| 412 |
)
|
| 413 |
gallery = gr.Gallery(
|
| 414 |
value=gallery_items(first_route),
|
| 415 |
columns=3,
|
| 416 |
rows=1,
|
| 417 |
+
height=170,
|
| 418 |
show_label=False,
|
| 419 |
allow_preview=False,
|
| 420 |
object_fit="cover",
|
|
|
|
| 427 |
with gr.Column(scale=6, min_width=420, elem_id="review-summary"):
|
| 428 |
with gr.Row(elem_id="result-columns", equal_height=True):
|
| 429 |
with gr.Column(scale=4, min_width=200, elem_id="metrics-panel"):
|
| 430 |
+
gr.HTML("<h2 class='inspector-subheading'>推理指标</h2>")
|
| 431 |
metrics = gr.HTML(metrics_html(ROUTE_META[first_route][0]))
|
| 432 |
with gr.Column(scale=6, min_width=240, elem_id="sidebar"):
|
| 433 |
gr.HTML(
|
docs/ui_case_pool_22_lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
-
"app.py": "
|
| 4 |
"assets/Manrope-OFL.txt": "e01b637272e0cbdfb240184dd98ea5cc671556d9894dae2668d92ab2c906787c",
|
| 5 |
"assets/Manrope-variable.ttf": "d0639be45d0af36e798172419d7bd173c4bd4f29e2b76cbb69db1d11bf8b0a40",
|
| 6 |
"assets/NotoSansCJK-OFL.txt": "6a73f9541c2de74158c0e7cf6b0a58ef774f5a780bf191f2d7ec9cc53efe2bf2",
|
|
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
+
"app.py": "a5966d2b8dfbe7adf31e6b9542cafcdf6b3198b25661cc97c5580dda680ecf6c",
|
| 4 |
"assets/Manrope-OFL.txt": "e01b637272e0cbdfb240184dd98ea5cc671556d9894dae2668d92ab2c906787c",
|
| 5 |
"assets/Manrope-variable.ttf": "d0639be45d0af36e798172419d7bd173c4bd4f29e2b76cbb69db1d11bf8b0a40",
|
| 6 |
"assets/NotoSansCJK-OFL.txt": "6a73f9541c2de74158c0e7cf6b0a58ef774f5a780bf191f2d7ec9cc53efe2bf2",
|