Deploy Project Halide Gradio Space
Browse files- ui/app.py +2 -25
- ui/components.py +0 -14
ui/app.py
CHANGED
|
@@ -22,7 +22,6 @@ from ui.components import (
|
|
| 22 |
EMPTY_STATE,
|
| 23 |
HEADER_HTML,
|
| 24 |
LIGHTTABLE_EMPTY_STATE,
|
| 25 |
-
LIGHTTABLE_RUNNING_STATE,
|
| 26 |
REPORT_EMPTY_STATE,
|
| 27 |
comparison_viewer_html,
|
| 28 |
confidence_notice_html,
|
|
@@ -154,20 +153,6 @@ def _review_gallery(pil_image: Any, annotated: Any) -> list[tuple[Any, str]]:
|
|
| 154 |
]
|
| 155 |
|
| 156 |
|
| 157 |
-
def _running_button_state() -> tuple[Any, str, Any]:
|
| 158 |
-
return (
|
| 159 |
-
gr.update(interactive=False, value="Diagnosing..."),
|
| 160 |
-
(
|
| 161 |
-
'<div class="halide-run-state active">'
|
| 162 |
-
'<span class="halide-run-eyebrow">Running</span>'
|
| 163 |
-
"<strong>GPU inspection in progress</strong>"
|
| 164 |
-
"<span>Vision extraction, validation, and report generation are running.</span>"
|
| 165 |
-
"</div>"
|
| 166 |
-
),
|
| 167 |
-
gr.update(value=LIGHTTABLE_RUNNING_STATE, visible=True),
|
| 168 |
-
)
|
| 169 |
-
|
| 170 |
-
|
| 171 |
def _attach_preview(result: dict, pil_image: Any, annotated: Any) -> dict:
|
| 172 |
result = dict(result)
|
| 173 |
if not isinstance(result.get("preview"), dict):
|
|
@@ -531,12 +516,7 @@ def build_app() -> gr.Blocks:
|
|
| 531 |
'target="_blank" rel="noreferrer">Source</a></footer>'
|
| 532 |
)
|
| 533 |
|
| 534 |
-
|
| 535 |
-
fn=_running_button_state,
|
| 536 |
-
outputs=[run_btn, run_state_output, lighttable_empty],
|
| 537 |
-
queue=False,
|
| 538 |
-
)
|
| 539 |
-
run_event.then(
|
| 540 |
fn=run_pipeline,
|
| 541 |
inputs=[
|
| 542 |
image_input,
|
|
@@ -563,10 +543,7 @@ def build_app() -> gr.Blocks:
|
|
| 563 |
history_select,
|
| 564 |
history_table,
|
| 565 |
],
|
| 566 |
-
|
| 567 |
-
fn=lambda: gr.update(interactive=True, value="Diagnose scan"),
|
| 568 |
-
outputs=[run_btn],
|
| 569 |
-
queue=False,
|
| 570 |
)
|
| 571 |
refresh_btn.click(
|
| 572 |
fn=refresh_history,
|
|
|
|
| 22 |
EMPTY_STATE,
|
| 23 |
HEADER_HTML,
|
| 24 |
LIGHTTABLE_EMPTY_STATE,
|
|
|
|
| 25 |
REPORT_EMPTY_STATE,
|
| 26 |
comparison_viewer_html,
|
| 27 |
confidence_notice_html,
|
|
|
|
| 153 |
]
|
| 154 |
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
def _attach_preview(result: dict, pil_image: Any, annotated: Any) -> dict:
|
| 157 |
result = dict(result)
|
| 158 |
if not isinstance(result.get("preview"), dict):
|
|
|
|
| 516 |
'target="_blank" rel="noreferrer">Source</a></footer>'
|
| 517 |
)
|
| 518 |
|
| 519 |
+
run_btn.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 520 |
fn=run_pipeline,
|
| 521 |
inputs=[
|
| 522 |
image_input,
|
|
|
|
| 543 |
history_select,
|
| 544 |
history_table,
|
| 545 |
],
|
| 546 |
+
api_name="run_pipeline",
|
|
|
|
|
|
|
|
|
|
| 547 |
)
|
| 548 |
refresh_btn.click(
|
| 549 |
fn=refresh_history,
|
ui/components.py
CHANGED
|
@@ -68,19 +68,6 @@ LIGHTTABLE_EMPTY_STATE = (
|
|
| 68 |
"</div>"
|
| 69 |
"</div>"
|
| 70 |
)
|
| 71 |
-
LIGHTTABLE_RUNNING_STATE = (
|
| 72 |
-
'<div class="halide-empty-lighttable active">'
|
| 73 |
-
'<div class="halide-empty-frame-grid">'
|
| 74 |
-
'<div><span>Vision extraction</span></div>'
|
| 75 |
-
'<div><span>Diagnostic report</span></div>'
|
| 76 |
-
"</div>"
|
| 77 |
-
'<div class="halide-empty-center">'
|
| 78 |
-
'<span>Running</span>'
|
| 79 |
-
'<strong>GPU inspection in progress</strong>'
|
| 80 |
-
"</div>"
|
| 81 |
-
"</div>"
|
| 82 |
-
)
|
| 83 |
-
|
| 84 |
REPORT_SECTIONS = {
|
| 85 |
"root cause": "Root cause",
|
| 86 |
"evidence": "Evidence",
|
|
@@ -545,7 +532,6 @@ __all__ = [
|
|
| 545 |
"HEADER_HTML",
|
| 546 |
"EMPTY_STATE",
|
| 547 |
"LIGHTTABLE_EMPTY_STATE",
|
| 548 |
-
"LIGHTTABLE_RUNNING_STATE",
|
| 549 |
"REPORT_EMPTY_STATE",
|
| 550 |
"compact_label_counts",
|
| 551 |
"comparison_viewer_html",
|
|
|
|
| 68 |
"</div>"
|
| 69 |
"</div>"
|
| 70 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
REPORT_SECTIONS = {
|
| 72 |
"root cause": "Root cause",
|
| 73 |
"evidence": "Evidence",
|
|
|
|
| 532 |
"HEADER_HTML",
|
| 533 |
"EMPTY_STATE",
|
| 534 |
"LIGHTTABLE_EMPTY_STATE",
|
|
|
|
| 535 |
"REPORT_EMPTY_STATE",
|
| 536 |
"compact_label_counts",
|
| 537 |
"comparison_viewer_html",
|