Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -165,7 +165,6 @@ def process_pipeline(pdf_file, hcc_code, model_version, csv_path=CSV_PATH, outpu
|
|
| 165 |
demographics_info = demographics_engine.run()
|
| 166 |
print(f"[DEMOGRAPHICS] Extracted: {demographics_info}")
|
| 167 |
|
| 168 |
-
# --- MODIFICATION: Using the elaborated method for demographics ---
|
| 169 |
initial_report_data = {
|
| 170 |
"file_name": file_name,
|
| 171 |
"hcc_code": hcc_code_str,
|
|
@@ -179,7 +178,6 @@ def process_pipeline(pdf_file, hcc_code, model_version, csv_path=CSV_PATH, outpu
|
|
| 179 |
"phone": demographics_info.get("phone", ""),
|
| 180 |
"patient_identifier": demographics_info.get("patient_identifier", "")
|
| 181 |
}
|
| 182 |
-
# --- END OF MODIFICATION ---
|
| 183 |
demographics_md = json_to_markdown(initial_report_data)
|
| 184 |
yield demographics_md
|
| 185 |
time.sleep(0.5)
|
|
@@ -249,7 +247,6 @@ def process_pipeline(pdf_file, hcc_code, model_version, csv_path=CSV_PATH, outpu
|
|
| 249 |
|
| 250 |
filtered_final_analysis = [e for e in final_analysis if e.get("answer_explicit", "").lower() == "yes" or e.get("answer_implicit", "").lower() == "yes"]
|
| 251 |
|
| 252 |
-
# --- MODIFICATION: Using the elaborated method for demographics ---
|
| 253 |
output_data = {
|
| 254 |
"file_name": file_name,
|
| 255 |
"hcc_code": hcc_code_str,
|
|
@@ -263,7 +260,6 @@ def process_pipeline(pdf_file, hcc_code, model_version, csv_path=CSV_PATH, outpu
|
|
| 263 |
"phone": demographics_info.get("phone", ""),
|
| 264 |
"patient_identifier": demographics_info.get("patient_identifier", "")
|
| 265 |
}
|
| 266 |
-
# --- END OF MODIFICATION ---
|
| 267 |
|
| 268 |
elapsed = time.time() - start
|
| 269 |
yield json_to_markdown(output_data) + f"<br/><div style='color:green;'>✅ Completed in {elapsed:.1f} sec</div>"
|
|
@@ -341,11 +337,18 @@ with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
|
|
| 341 |
outputs=[output_md],
|
| 342 |
)
|
| 343 |
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 349 |
|
| 350 |
|
| 351 |
if __name__ == "__main__":
|
|
@@ -354,7 +357,6 @@ if __name__ == "__main__":
|
|
| 354 |
server_port=int(os.environ.get("PORT", 7860))
|
| 355 |
)
|
| 356 |
|
| 357 |
-
|
| 358 |
# import os
|
| 359 |
# import gradio as gr
|
| 360 |
# import json
|
|
|
|
| 165 |
demographics_info = demographics_engine.run()
|
| 166 |
print(f"[DEMOGRAPHICS] Extracted: {demographics_info}")
|
| 167 |
|
|
|
|
| 168 |
initial_report_data = {
|
| 169 |
"file_name": file_name,
|
| 170 |
"hcc_code": hcc_code_str,
|
|
|
|
| 178 |
"phone": demographics_info.get("phone", ""),
|
| 179 |
"patient_identifier": demographics_info.get("patient_identifier", "")
|
| 180 |
}
|
|
|
|
| 181 |
demographics_md = json_to_markdown(initial_report_data)
|
| 182 |
yield demographics_md
|
| 183 |
time.sleep(0.5)
|
|
|
|
| 247 |
|
| 248 |
filtered_final_analysis = [e for e in final_analysis if e.get("answer_explicit", "").lower() == "yes" or e.get("answer_implicit", "").lower() == "yes"]
|
| 249 |
|
|
|
|
| 250 |
output_data = {
|
| 251 |
"file_name": file_name,
|
| 252 |
"hcc_code": hcc_code_str,
|
|
|
|
| 260 |
"phone": demographics_info.get("phone", ""),
|
| 261 |
"patient_identifier": demographics_info.get("patient_identifier", "")
|
| 262 |
}
|
|
|
|
| 263 |
|
| 264 |
elapsed = time.time() - start
|
| 265 |
yield json_to_markdown(output_data) + f"<br/><div style='color:green;'>✅ Completed in {elapsed:.1f} sec</div>"
|
|
|
|
| 337 |
outputs=[output_md],
|
| 338 |
)
|
| 339 |
|
| 340 |
+
# --- MODIFICATION: Adjusted column scaling to make the Examples section smaller ---
|
| 341 |
+
with gr.Row():
|
| 342 |
+
with gr.Column(scale=1): # This column will be smaller
|
| 343 |
+
gr.Examples(
|
| 344 |
+
examples=[[SAMPLE_PDF, "12", "V24"]],
|
| 345 |
+
inputs=[pdf_upload, hcc_code, model_version],
|
| 346 |
+
label="Click to load an example",
|
| 347 |
+
cache_examples=False
|
| 348 |
+
)
|
| 349 |
+
with gr.Column(scale=2): # This empty column will take up the remaining space
|
| 350 |
+
pass
|
| 351 |
+
# --- END OF MODIFICATION ---
|
| 352 |
|
| 353 |
|
| 354 |
if __name__ == "__main__":
|
|
|
|
| 357 |
server_port=int(os.environ.get("PORT", 7860))
|
| 358 |
)
|
| 359 |
|
|
|
|
| 360 |
# import os
|
| 361 |
# import gradio as gr
|
| 362 |
# import json
|