surinala commited on
Commit
2297d52
·
1 Parent(s): 0f1ca16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -161,13 +161,13 @@ def main():
161
  doc = fitz.open(temp_file)
162
  highlight_pdf(doc, delete_df)
163
 
164
- # Save the highlighted PDF
165
- highlighted_path = './highlighted.pdf'
166
- doc.save(highlighted_path)
167
-
168
  # Display download link for the highlighted PDF
169
  st.subheader("Download Highlighted PDF")
170
- st.markdown(get_download_link(highlighted_path, 'Download Highlighted PDF'), unsafe_allow_html=True)
171
 
172
  # Cleanup: Remove temporary file
173
  os.remove(temp_file_path)
 
161
  doc = fitz.open(temp_file)
162
  highlight_pdf(doc, delete_df)
163
 
164
+ # Save the highlighted PDF to a temporary file
165
+ highlighted_temp_path = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False).name
166
+ doc.save(highlighted_temp_path)
167
+
168
  # Display download link for the highlighted PDF
169
  st.subheader("Download Highlighted PDF")
170
+ st.markdown(get_download_link(highlighted_temp_path, 'Download Highlighted PDF'), unsafe_allow_html=True)
171
 
172
  # Cleanup: Remove temporary file
173
  os.remove(temp_file_path)