Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,10 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
3 |
import hashlib
|
4 |
import shutil
|
@@ -178,8 +184,9 @@ Medical Records:
|
|
178 |
response_chunks.extend([c.content for c in chunk if hasattr(c, 'content')])
|
179 |
partial_response = "".join(response_chunks)
|
180 |
cleaned_partial = partial_response.split("[TOOL_CALLS]")[0].strip()
|
181 |
-
|
182 |
-
|
|
|
183 |
except Exception as e:
|
184 |
history[-1] = {"role": "assistant", "content": f"❌ Error: {str(e)}"}
|
185 |
yield history, None
|
@@ -208,4 +215,4 @@ if __name__ == "__main__":
|
|
208 |
show_error=True,
|
209 |
allowed_paths=[report_dir],
|
210 |
share=False
|
211 |
-
)
|
|
|
1 |
+
import sys
|
2 |
+
import os
|
3 |
+
import pandas as pd
|
4 |
+
import pdfplumber
|
5 |
+
import json
|
6 |
+
import gradio as gr
|
7 |
+
from typing import List
|
8 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
9 |
import hashlib
|
10 |
import shutil
|
|
|
184 |
response_chunks.extend([c.content for c in chunk if hasattr(c, 'content')])
|
185 |
partial_response = "".join(response_chunks)
|
186 |
cleaned_partial = partial_response.split("[TOOL_CALLS]")[0].strip()
|
187 |
+
if cleaned_partial:
|
188 |
+
history[-1] = {"role": "assistant", "content": cleaned_partial}
|
189 |
+
yield history, None
|
190 |
except Exception as e:
|
191 |
history[-1] = {"role": "assistant", "content": f"❌ Error: {str(e)}"}
|
192 |
yield history, None
|
|
|
215 |
show_error=True,
|
216 |
allowed_paths=[report_dir],
|
217 |
share=False
|
218 |
+
)
|