IAMTFRMZA commited on
Commit
60685da
·
verified ·
1 Parent(s): b320475
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -3,6 +3,7 @@ from openai import OpenAI
3
  import time
4
  import pandas as pd
5
  from docx import Document
 
6
 
7
  # Set the page configuration
8
  st.set_page_config(page_title="LOR Chat ReportAi")
@@ -92,9 +93,10 @@ if uploaded_file:
92
  doc.add_heading('AI Assistant Report', 0)
93
  doc.add_paragraph(assistant_message)
94
 
95
- # Define the save path - Ensure it's accessible
96
  try:
97
- word_filename = "/mnt/data/AI_Report.docx"
 
98
  doc.save(word_filename)
99
 
100
  # Provide download link
@@ -102,7 +104,7 @@ if uploaded_file:
102
  st.download_button(
103
  label="Download the Report",
104
  data=file.read(),
105
- file_name="AI_Report.docx",
106
  mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
107
  )
108
  except Exception as e:
 
3
  import time
4
  import pandas as pd
5
  from docx import Document
6
+ import os
7
 
8
  # Set the page configuration
9
  st.set_page_config(page_title="LOR Chat ReportAi")
 
93
  doc.add_heading('AI Assistant Report', 0)
94
  doc.add_paragraph(assistant_message)
95
 
96
+ # Save the document to a valid path for Hugging Face environment
97
  try:
98
+ # Use a local file path in the current working directory
99
+ word_filename = "AI_Report.docx"
100
  doc.save(word_filename)
101
 
102
  # Provide download link
 
104
  st.download_button(
105
  label="Download the Report",
106
  data=file.read(),
107
+ file_name=word_filename,
108
  mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
109
  )
110
  except Exception as e: