Update app.py
Browse files
app.py
CHANGED
@@ -108,17 +108,17 @@ def init_agent():
|
|
108 |
agent.init_model()
|
109 |
return agent
|
110 |
|
111 |
-
def stream_report(agent,
|
112 |
accumulated_text = ""
|
113 |
try:
|
114 |
-
if
|
115 |
yield "❌ Please upload a valid Excel file.", None, ""
|
116 |
return
|
117 |
|
118 |
-
if hasattr(
|
119 |
-
text = extract_text_from_excel(
|
120 |
-
elif isinstance(
|
121 |
-
text = extract_text_from_excel(
|
122 |
else:
|
123 |
raise ValueError("❌ Invalid or missing file.")
|
124 |
|
|
|
108 |
agent.init_model()
|
109 |
return agent
|
110 |
|
111 |
+
def stream_report(agent, input_file: Union[str, 'file'], full_output: str) -> Generator[Tuple[str, Union[str, None], str], None, None]:
|
112 |
accumulated_text = ""
|
113 |
try:
|
114 |
+
if input_file is None:
|
115 |
yield "❌ Please upload a valid Excel file.", None, ""
|
116 |
return
|
117 |
|
118 |
+
if hasattr(input_file, "read"):
|
119 |
+
text = extract_text_from_excel(input_file)
|
120 |
+
elif isinstance(input_file, str) and os.path.exists(input_file):
|
121 |
+
text = extract_text_from_excel(input_file)
|
122 |
else:
|
123 |
raise ValueError("❌ Invalid or missing file.")
|
124 |
|