Spaces:
Sleeping
Sleeping
app.py
Browse files
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 |
-
#
|
96 |
try:
|
97 |
-
|
|
|
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=
|
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:
|