Dimitris commited on
Commit ·
d6f3827
1
Parent(s): 6cf9c59
fix(ui): hide API-key field in offline mode; flatten report double-box
Browse files
app.py
CHANGED
|
@@ -12,6 +12,11 @@ from src.extraction import build_extractor
|
|
| 12 |
|
| 13 |
load_local_env()
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
def extract_lab_values(
|
| 16 |
uploaded_file: str | None,
|
| 17 |
api_key_override: str,
|
|
@@ -2302,6 +2307,11 @@ button.bte-action *,
|
|
| 2302 |
|
| 2303 |
|
| 2304 |
with gr.Blocks(title="Blood Test Explainer") as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2305 |
with gr.Row(equal_height=True, elem_classes=["bte-title"]):
|
| 2306 |
with gr.Column(scale=6, min_width=420, elem_classes=["bte-title-copy"]):
|
| 2307 |
gr.HTML(
|
|
@@ -2313,7 +2323,7 @@ with gr.Blocks(title="Blood Test Explainer") as demo:
|
|
| 2313 |
</div>
|
| 2314 |
"""
|
| 2315 |
)
|
| 2316 |
-
with gr.Column(scale=4, min_width=360):
|
| 2317 |
with gr.Group(elem_classes=["bte-api-key-panel"]):
|
| 2318 |
api_key_override = gr.Textbox(
|
| 2319 |
label="OpenBMB API key",
|
|
@@ -2379,7 +2389,7 @@ with gr.Blocks(title="Blood Test Explainer") as demo:
|
|
| 2379 |
show_progress="hidden",
|
| 2380 |
)
|
| 2381 |
|
| 2382 |
-
with gr.Group(visible=False) as report_panel:
|
| 2383 |
report = gr.HTML(empty_report_html())
|
| 2384 |
|
| 2385 |
run_button.click(
|
|
|
|
| 12 |
|
| 13 |
load_local_env()
|
| 14 |
|
| 15 |
+
# The hosted-API key field is only relevant when the API backend is active; in offline
|
| 16 |
+
# (local) modes it's dead weight, so we only show it when EXTRACTOR_BACKEND == "api".
|
| 17 |
+
_API_MODE = os.getenv("EXTRACTOR_BACKEND", "auto").strip().lower() == "api"
|
| 18 |
+
|
| 19 |
+
|
| 20 |
def extract_lab_values(
|
| 21 |
uploaded_file: str | None,
|
| 22 |
api_key_override: str,
|
|
|
|
| 2307 |
|
| 2308 |
|
| 2309 |
with gr.Blocks(title="Blood Test Explainer") as demo:
|
| 2310 |
+
# Flatten the report container so only the inner .bte-report card shows (no double box).
|
| 2311 |
+
gr.HTML(
|
| 2312 |
+
"<style>.bte-report-panel,.bte-report-panel>*{background:transparent !important;"
|
| 2313 |
+
"border:0 !important;box-shadow:none !important;padding:0 !important;}</style>"
|
| 2314 |
+
)
|
| 2315 |
with gr.Row(equal_height=True, elem_classes=["bte-title"]):
|
| 2316 |
with gr.Column(scale=6, min_width=420, elem_classes=["bte-title-copy"]):
|
| 2317 |
gr.HTML(
|
|
|
|
| 2323 |
</div>
|
| 2324 |
"""
|
| 2325 |
)
|
| 2326 |
+
with gr.Column(scale=4, min_width=360, visible=_API_MODE):
|
| 2327 |
with gr.Group(elem_classes=["bte-api-key-panel"]):
|
| 2328 |
api_key_override = gr.Textbox(
|
| 2329 |
label="OpenBMB API key",
|
|
|
|
| 2389 |
show_progress="hidden",
|
| 2390 |
)
|
| 2391 |
|
| 2392 |
+
with gr.Group(visible=False, elem_classes=["bte-report-panel"]) as report_panel:
|
| 2393 |
report = gr.HTML(empty_report_html())
|
| 2394 |
|
| 2395 |
run_button.click(
|