Muhammadidrees commited on
Commit
b54dc60
Β·
verified Β·
1 Parent(s): 438bc72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -5
app.py CHANGED
@@ -86,14 +86,29 @@ Lab Values:
86
  # Call LLM
87
  result = pipe(
88
  prompt,
89
- max_new_tokens=1500,
90
  do_sample=True,
91
  temperature=0.3,
92
  top_p=0.9,
93
  return_full_text=False
94
  )
95
 
96
- return result[0]["generated_text"].strip()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
 
99
  # -----------------------
@@ -130,14 +145,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
130
 
131
  analyze_btn = gr.Button("πŸ”¬ Generate Report", variant="primary")
132
 
133
- gr.Markdown("### πŸ“Š Analysis Output")
134
- output = gr.Markdown(label="Medical Report")
 
 
 
 
 
135
 
136
  analyze_btn.click(
137
  fn=analyze,
138
  inputs=[albumin, creatinine, glucose, crp, mcv, rdw, alp,
139
  wbc, lymph, age, gender, height, weight],
140
- outputs=output
141
  )
142
 
143
  gr.Markdown(
 
86
  # Call LLM
87
  result = pipe(
88
  prompt,
89
+ max_new_tokens=2000,
90
  do_sample=True,
91
  temperature=0.3,
92
  top_p=0.9,
93
  return_full_text=False
94
  )
95
 
96
+ text = result[0]["generated_text"].strip()
97
+
98
+ # Split into left (sections 1–3) and right (sections 5–6)
99
+ left_sections = []
100
+ right_sections = []
101
+ capture_left = True
102
+
103
+ for line in text.splitlines():
104
+ if line.strip().startswith("5. Tabular Mapping"):
105
+ capture_left = False
106
+ if capture_left:
107
+ left_sections.append(line)
108
+ else:
109
+ right_sections.append(line)
110
+
111
+ return "\n".join(left_sections), "\n".join(right_sections)
112
 
113
 
114
  # -----------------------
 
145
 
146
  analyze_btn = gr.Button("πŸ”¬ Generate Report", variant="primary")
147
 
148
+ with gr.Row():
149
+ with gr.Column(scale=1):
150
+ gr.Markdown("### πŸ“ Summary & Action Plan")
151
+ left_output = gr.Markdown()
152
+ with gr.Column(scale=1):
153
+ gr.Markdown("### πŸ“Š Tabular & AI Insights")
154
+ right_output = gr.Markdown()
155
 
156
  analyze_btn.click(
157
  fn=analyze,
158
  inputs=[albumin, creatinine, glucose, crp, mcv, rdw, alp,
159
  wbc, lymph, age, gender, height, weight],
160
+ outputs=[left_output, right_output]
161
  )
162
 
163
  gr.Markdown(