Danial7 commited on
Commit
f51020c
·
verified ·
1 Parent(s): a2e5023

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -110,14 +110,17 @@ if uploaded_file is not None:
110
 
111
  # --- PDF Download Button ---
112
  st.subheader("Download Report")
113
- if st.button("Generate PDF Report"):
114
- pdf = generate_pdf_report(cv_type, education_level, score, score_breakdown, certs, edu, visa, advice, jobs, fig)
115
- with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp_pdf:
116
- pdf.output(tmp_pdf.name)
117
- with open(tmp_pdf.name, "rb") as f:
118
- st.download_button(
119
- label="📄 Download CV Analysis Report (PDF)",
120
- data=f,
121
- file_name="cv_analysis_report.pdf",
122
- mime="application/pdf"
123
- )
 
 
 
 
110
 
111
  # --- PDF Download Button ---
112
  st.subheader("Download Report")
113
+ pdf = generate_pdf_report(cv_type, education_level, score, score_breakdown, certs, edu, visa, advice, jobs, fig)
114
+
115
+ # Generate PDF in memory and provide download button
116
+ pdf_buffer = io.BytesIO()
117
+ pdf.output(pdf_buffer)
118
+ pdf_buffer.seek(0)
119
+
120
+ st.download_button(
121
+ label="📄 Download CV Analysis Report (PDF)",
122
+ data=pdf_buffer,
123
+ file_name="cv_analysis_report.pdf",
124
+ mime="application/pdf"
125
+ )
126
+