Spaces:
Sleeping
Sleeping
Deploy Project Halide Gradio Space
Browse files- app.py +1 -0
- ui/app.py +14 -8
- ui/server.py +1 -0
app.py
CHANGED
|
@@ -22,6 +22,7 @@ def main() -> None:
|
|
| 22 |
theme=build_theme(),
|
| 23 |
css=THEME_CSS,
|
| 24 |
allowed_paths=["assets"],
|
|
|
|
| 25 |
max_file_size="60mb",
|
| 26 |
)
|
| 27 |
|
|
|
|
| 22 |
theme=build_theme(),
|
| 23 |
css=THEME_CSS,
|
| 24 |
allowed_paths=["assets"],
|
| 25 |
+
favicon_path="assets/logo.jpg",
|
| 26 |
max_file_size="60mb",
|
| 27 |
)
|
| 28 |
|
ui/app.py
CHANGED
|
@@ -103,14 +103,15 @@ def _empty_outputs(
|
|
| 103 |
) -> tuple[Any, Any, str, str, str, str, str, str, str, list[list[str]], str, str, Any, list[list[str]]]:
|
| 104 |
history_html, selected_entry, selector_update, history_rows = _history_state()
|
| 105 |
empty = f'<p class="halide-muted">{html.escape(message)}</p>'
|
|
|
|
| 106 |
return (
|
| 107 |
None,
|
| 108 |
gr.update(value=[], visible=False),
|
| 109 |
run_state_html(None),
|
| 110 |
empty,
|
| 111 |
empty,
|
| 112 |
-
|
| 113 |
-
|
| 114 |
"",
|
| 115 |
"{}",
|
| 116 |
[],
|
|
@@ -228,8 +229,11 @@ def run_pipeline(
|
|
| 228 |
run_state = run_state_html(result)
|
| 229 |
stats = stats_html(result)
|
| 230 |
notice = confidence_notice_html(result)
|
| 231 |
-
pills = defect_pills_html(counts)
|
| 232 |
-
diag =
|
|
|
|
|
|
|
|
|
|
| 233 |
meta = metadata_html(result)
|
| 234 |
raw_json = raw_json_text(result)
|
| 235 |
table_rows = defect_table_rows(result)
|
|
@@ -260,14 +264,15 @@ def run_pipeline(
|
|
| 260 |
f"{html.escape(str(exc))}</pre></div>"
|
| 261 |
)
|
| 262 |
history, selected_entry, selector_update, history_rows = _history_state()
|
|
|
|
| 263 |
return (
|
| 264 |
None,
|
| 265 |
gr.update(value=[], visible=False),
|
| 266 |
err,
|
| 267 |
err,
|
| 268 |
"",
|
| 269 |
-
|
| 270 |
-
|
| 271 |
"",
|
| 272 |
"{}",
|
| 273 |
[],
|
|
@@ -404,8 +409,8 @@ def build_app() -> gr.Blocks:
|
|
| 404 |
with gr.Tabs(selected="report", elem_classes="halide-inspector-tabs"):
|
| 405 |
with gr.Tab("Report", id="report"):
|
| 406 |
notice_output = gr.HTML(value=REPORT_EMPTY_STATE)
|
| 407 |
-
defect_summary = gr.HTML(value="")
|
| 408 |
-
diagnosis_output = gr.HTML(value="")
|
| 409 |
with gr.Tab("Evidence", id="evidence"):
|
| 410 |
stats_output = gr.HTML(value=EMPTY_STATE)
|
| 411 |
metadata_output = gr.HTML(value=EMPTY_STATE)
|
|
@@ -519,6 +524,7 @@ def main() -> None:
|
|
| 519 |
theme=build_theme(),
|
| 520 |
css=THEME_CSS,
|
| 521 |
allowed_paths=["assets"],
|
|
|
|
| 522 |
max_file_size="60mb",
|
| 523 |
)
|
| 524 |
|
|
|
|
| 103 |
) -> tuple[Any, Any, str, str, str, str, str, str, str, list[list[str]], str, str, Any, list[list[str]]]:
|
| 104 |
history_html, selected_entry, selector_update, history_rows = _history_state()
|
| 105 |
empty = f'<p class="halide-muted">{html.escape(message)}</p>'
|
| 106 |
+
hidden_html = gr.update(value="", visible=False)
|
| 107 |
return (
|
| 108 |
None,
|
| 109 |
gr.update(value=[], visible=False),
|
| 110 |
run_state_html(None),
|
| 111 |
empty,
|
| 112 |
empty,
|
| 113 |
+
hidden_html,
|
| 114 |
+
hidden_html,
|
| 115 |
"",
|
| 116 |
"{}",
|
| 117 |
[],
|
|
|
|
| 229 |
run_state = run_state_html(result)
|
| 230 |
stats = stats_html(result)
|
| 231 |
notice = confidence_notice_html(result)
|
| 232 |
+
pills = gr.update(value=defect_pills_html(counts), visible=True)
|
| 233 |
+
diag = gr.update(
|
| 234 |
+
value=diagnosis_html(result.get("diagnosis", {}).get("diagnosis_text", "")),
|
| 235 |
+
visible=True,
|
| 236 |
+
)
|
| 237 |
meta = metadata_html(result)
|
| 238 |
raw_json = raw_json_text(result)
|
| 239 |
table_rows = defect_table_rows(result)
|
|
|
|
| 264 |
f"{html.escape(str(exc))}</pre></div>"
|
| 265 |
)
|
| 266 |
history, selected_entry, selector_update, history_rows = _history_state()
|
| 267 |
+
hidden_html = gr.update(value="", visible=False)
|
| 268 |
return (
|
| 269 |
None,
|
| 270 |
gr.update(value=[], visible=False),
|
| 271 |
err,
|
| 272 |
err,
|
| 273 |
"",
|
| 274 |
+
hidden_html,
|
| 275 |
+
hidden_html,
|
| 276 |
"",
|
| 277 |
"{}",
|
| 278 |
[],
|
|
|
|
| 409 |
with gr.Tabs(selected="report", elem_classes="halide-inspector-tabs"):
|
| 410 |
with gr.Tab("Report", id="report"):
|
| 411 |
notice_output = gr.HTML(value=REPORT_EMPTY_STATE)
|
| 412 |
+
defect_summary = gr.HTML(value="", visible=False)
|
| 413 |
+
diagnosis_output = gr.HTML(value="", visible=False)
|
| 414 |
with gr.Tab("Evidence", id="evidence"):
|
| 415 |
stats_output = gr.HTML(value=EMPTY_STATE)
|
| 416 |
metadata_output = gr.HTML(value=EMPTY_STATE)
|
|
|
|
| 524 |
theme=build_theme(),
|
| 525 |
css=THEME_CSS,
|
| 526 |
allowed_paths=["assets"],
|
| 527 |
+
favicon_path="assets/logo.jpg",
|
| 528 |
max_file_size="60mb",
|
| 529 |
)
|
| 530 |
|
ui/server.py
CHANGED
|
@@ -33,6 +33,7 @@ def build_server(blocks: gr.Blocks | None = None) -> gr.Server:
|
|
| 33 |
css=THEME_CSS,
|
| 34 |
show_error=True,
|
| 35 |
allowed_paths=["assets"],
|
|
|
|
| 36 |
max_file_size="60mb",
|
| 37 |
)
|
| 38 |
return server
|
|
|
|
| 33 |
css=THEME_CSS,
|
| 34 |
show_error=True,
|
| 35 |
allowed_paths=["assets"],
|
| 36 |
+
favicon_path="assets/logo.jpg",
|
| 37 |
max_file_size="60mb",
|
| 38 |
)
|
| 39 |
return server
|