Ali2206 commited on
Commit
ca6d5de
·
verified ·
1 Parent(s): 6762641

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -108,17 +108,17 @@ def init_agent():
108
  agent.init_model()
109
  return agent
110
 
111
- def stream_report(agent, file: Union[str, 'file'], full_output: str) -> Generator[Tuple[str, Union[str, None], str], None, None]:
112
  accumulated_text = ""
113
  try:
114
- if file is None:
115
  yield "❌ Please upload a valid Excel file.", None, ""
116
  return
117
 
118
- if hasattr(file, "read"):
119
- text = extract_text_from_excel(file)
120
- elif isinstance(file, str) and os.path.exists(file):
121
- text = extract_text_from_excel(file)
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