Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -282,6 +282,48 @@ def pdf_to_iframe(file):
|
|
| 282 |
|
| 283 |
|
| 284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
# ---------- Gradio UI ----------
|
| 286 |
with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
|
| 287 |
gr.HTML(f"""
|
|
@@ -298,9 +340,11 @@ with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
|
|
| 298 |
run_btn = gr.Button("π Run Validation", variant="primary", scale=1)
|
| 299 |
|
| 300 |
with gr.Row():
|
|
|
|
| 301 |
with gr.Column(scale=2):
|
| 302 |
pdf_preview = gr.HTML(label="π PDF Preview", value="<p>Upload a PDF to preview</p>")
|
| 303 |
-
|
|
|
|
| 304 |
output_md = gr.Markdown(
|
| 305 |
label="Validation Report",
|
| 306 |
value="<div style='border:2px solid #1e40af; border-radius:12px; padding:15px; background-color:#f0f9ff;'>π Upload a PDF and click <b>Run Validation</b> to start.</div>",
|
|
@@ -322,7 +366,7 @@ with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
|
|
| 322 |
outputs=[output_md],
|
| 323 |
fn=lambda x: process_pipeline(load_sample_pdf(), hcc_code="12", model_version="V24"),
|
| 324 |
cache_examples=False
|
| 325 |
-
)
|
| 326 |
|
| 327 |
|
| 328 |
if __name__ == "__main__":
|
|
|
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
+
# ---------- Gradio UI ----------
|
| 286 |
+
# with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
|
| 287 |
+
# gr.HTML(f"""
|
| 288 |
+
# <h1 style='text-align:center;color:#1e40af;'> π© {APP_TITLE}</h1>
|
| 289 |
+
# <p style='text-align:center;color:#64748b;'>
|
| 290 |
+
# Upload a chart, set HCC + model version, and validate MEAT criteria.
|
| 291 |
+
# </p>
|
| 292 |
+
# """)
|
| 293 |
+
|
| 294 |
+
# with gr.Row():
|
| 295 |
+
# pdf_upload = gr.File(label="Upload Patient Chart (PDF)", file_types=[".pdf"], scale=2)
|
| 296 |
+
# hcc_code = gr.Textbox(label="HCC Code (e.g., 12)", placeholder="Enter HCC code", scale=1)
|
| 297 |
+
# model_version = gr.Dropdown(choices=["V24", "V28"], label="Model Version", value="V24", scale=1)
|
| 298 |
+
# run_btn = gr.Button("π Run Validation", variant="primary", scale=1)
|
| 299 |
+
|
| 300 |
+
# with gr.Row():
|
| 301 |
+
# with gr.Column(scale=2):
|
| 302 |
+
# pdf_preview = gr.HTML(label="π PDF Preview", value="<p>Upload a PDF to preview</p>")
|
| 303 |
+
# with gr.Column(scale=2):
|
| 304 |
+
# output_md = gr.Markdown(
|
| 305 |
+
# label="Validation Report",
|
| 306 |
+
# value="<div style='border:2px solid #1e40af; border-radius:12px; padding:15px; background-color:#f0f9ff;'>π Upload a PDF and click <b>Run Validation</b> to start.</div>",
|
| 307 |
+
# )
|
| 308 |
+
|
| 309 |
+
# # Connect PDF upload to preview
|
| 310 |
+
# pdf_upload.change(fn=pdf_to_iframe, inputs=pdf_upload, outputs=pdf_preview)
|
| 311 |
+
|
| 312 |
+
# # Connect run button with progress
|
| 313 |
+
# run_btn.click(
|
| 314 |
+
# fn=process_pipeline,
|
| 315 |
+
# inputs=[pdf_upload, hcc_code, model_version],
|
| 316 |
+
# outputs=[output_md],
|
| 317 |
+
# )
|
| 318 |
+
|
| 319 |
+
# gr.Examples(
|
| 320 |
+
# examples=[[SAMPLE_PDF]],
|
| 321 |
+
# inputs=[pdf_upload],
|
| 322 |
+
# outputs=[output_md],
|
| 323 |
+
# fn=lambda x: process_pipeline(load_sample_pdf(), hcc_code="12", model_version="V24"),
|
| 324 |
+
# cache_examples=False
|
| 325 |
+
)
|
| 326 |
+
|
| 327 |
# ---------- Gradio UI ----------
|
| 328 |
with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
|
| 329 |
gr.HTML(f"""
|
|
|
|
| 340 |
run_btn = gr.Button("π Run Validation", variant="primary", scale=1)
|
| 341 |
|
| 342 |
with gr.Row():
|
| 343 |
+
# This column now correctly corresponds to the pdf_upload scale
|
| 344 |
with gr.Column(scale=2):
|
| 345 |
pdf_preview = gr.HTML(label="π PDF Preview", value="<p>Upload a PDF to preview</p>")
|
| 346 |
+
# This column's scale is adjusted to 3 to match the controls above
|
| 347 |
+
with gr.Column(scale=3):
|
| 348 |
output_md = gr.Markdown(
|
| 349 |
label="Validation Report",
|
| 350 |
value="<div style='border:2px solid #1e40af; border-radius:12px; padding:15px; background-color:#f0f9ff;'>π Upload a PDF and click <b>Run Validation</b> to start.</div>",
|
|
|
|
| 366 |
outputs=[output_md],
|
| 367 |
fn=lambda x: process_pipeline(load_sample_pdf(), hcc_code="12", model_version="V24"),
|
| 368 |
cache_examples=False
|
| 369 |
+
)
|
| 370 |
|
| 371 |
|
| 372 |
if __name__ == "__main__":
|