vithacocf commited on
Commit
094931e
·
verified ·
1 Parent(s): 293c06c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -392,8 +392,18 @@ def run_process(file, question, model_choice, temperature, top_p, external_api_u
392
  if check_result > 1:
393
  base_name = os.path.splitext(filename)[0]
394
  tmp_dir = tempfile.gettempdir()
 
 
 
 
 
 
 
395
  excel_path = os.path.join(tmp_dir, f"{base_name}.xlsx")
396
- export_pdf_to_excel(filename, excel_path)
 
 
 
397
  chunks = split_excel_by_airline_header(excel_path)
398
  header, _ = run_process_internal_base_v2(
399
  file_bytes=file_bytes,
 
392
  if check_result > 1:
393
  base_name = os.path.splitext(filename)[0]
394
  tmp_dir = tempfile.gettempdir()
395
+
396
+ # 🔁 Ghi file PDF tạm để xử lý
397
+ tmp_pdf_path = os.path.join(tmp_dir, f"{base_name}.pdf")
398
+ with open(tmp_pdf_path, "wb") as f:
399
+ f.write(file_bytes)
400
+
401
+ # 🔁 Tạo đường dẫn file Excel
402
  excel_path = os.path.join(tmp_dir, f"{base_name}.xlsx")
403
+
404
+ # 🛠 Gọi hàm xử lý
405
+ export_pdf_to_excel(tmp_pdf_path, excel_path)
406
+
407
  chunks = split_excel_by_airline_header(excel_path)
408
  header, _ = run_process_internal_base_v2(
409
  file_bytes=file_bytes,