Update app.py
Browse files
app.py
CHANGED
@@ -138,7 +138,7 @@ def stream_final_report(agent, file) -> Generator[Tuple[List[Dict[str, str]], Un
|
|
138 |
|
139 |
try:
|
140 |
# Initial processing message
|
141 |
-
messages = [{"role": "user", "content": f"Processing Excel file: {file.name}"},
|
142 |
{"role": "assistant", "content": "⏳ Extracting and analyzing data..."}]
|
143 |
yield messages, None
|
144 |
|
@@ -214,7 +214,7 @@ def stream_final_report(agent, file) -> Generator[Tuple[List[Dict[str, str]], Un
|
|
214 |
yield messages, report_path
|
215 |
|
216 |
except Exception as e:
|
217 |
-
messages.append({"role": "assistant", "content": f"❌ Error: {str(e)}"})
|
218 |
yield messages, None
|
219 |
|
220 |
|
@@ -228,6 +228,7 @@ def create_ui(agent):
|
|
228 |
label="Clinical Assistant",
|
229 |
show_copy_button=True,
|
230 |
height=600,
|
|
|
231 |
avatar_images=(
|
232 |
None, # User avatar
|
233 |
"https://i.imgur.com/6wX7Zb4.png" # Bot avatar
|
@@ -248,11 +249,6 @@ def create_ui(agent):
|
|
248 |
visible=False,
|
249 |
interactive=False
|
250 |
)
|
251 |
-
gr.Examples(
|
252 |
-
examples=["sample_data/sample_patient_history.xlsx"],
|
253 |
-
inputs=file_upload,
|
254 |
-
label="Sample Files"
|
255 |
-
)
|
256 |
|
257 |
analyze_btn.click(
|
258 |
fn=lambda file: stream_final_report(agent, file),
|
@@ -266,11 +262,6 @@ def create_ui(agent):
|
|
266 |
return gr.File(visible=True, value=report_path)
|
267 |
return gr.File(visible=False)
|
268 |
|
269 |
-
demo.load(
|
270 |
-
lambda: None,
|
271 |
-
outputs=report_output
|
272 |
-
)
|
273 |
-
|
274 |
return demo
|
275 |
|
276 |
|
|
|
138 |
|
139 |
try:
|
140 |
# Initial processing message
|
141 |
+
messages = [{"role": "user", "content": f"Processing Excel file: {os.path.basename(file.name)}"},
|
142 |
{"role": "assistant", "content": "⏳ Extracting and analyzing data..."}]
|
143 |
yield messages, None
|
144 |
|
|
|
214 |
yield messages, report_path
|
215 |
|
216 |
except Exception as e:
|
217 |
+
messages.append({"role": "assistant", "content": f"❌ Error processing file: {str(e)}"})
|
218 |
yield messages, None
|
219 |
|
220 |
|
|
|
228 |
label="Clinical Assistant",
|
229 |
show_copy_button=True,
|
230 |
height=600,
|
231 |
+
type="messages",
|
232 |
avatar_images=(
|
233 |
None, # User avatar
|
234 |
"https://i.imgur.com/6wX7Zb4.png" # Bot avatar
|
|
|
249 |
visible=False,
|
250 |
interactive=False
|
251 |
)
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
analyze_btn.click(
|
254 |
fn=lambda file: stream_final_report(agent, file),
|
|
|
262 |
return gr.File(visible=True, value=report_path)
|
263 |
return gr.File(visible=False)
|
264 |
|
|
|
|
|
|
|
|
|
|
|
265 |
return demo
|
266 |
|
267 |
|