Sabir55 commited on
Commit
b85b061
Β·
verified Β·
1 Parent(s): 4e1f1e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -91,9 +91,8 @@ def generate_certificate(user_name: str, score: int, topic: str):
91
  safe_name = clean_filename(user_name)
92
  safe_topic = clean_filename(topic)
93
  filename = f"Certificate_{safe_name}_{safe_topic}.pdf"
94
- filepath = f"/mnt/data/{filename}"
95
- pdf.output(filepath)
96
- return filepath
97
 
98
  # ------------------------------
99
  # Quiz UI
@@ -124,7 +123,7 @@ def show_intro_and_quiz(topic):
124
  st.balloons()
125
  cert_path = generate_certificate(user_name, score, topic)
126
  st.markdown("### πŸŽ“ Download Your Certificate")
127
- st.download_button("πŸ“„ Download Certificate", data=open(cert_path, "rb"), file_name=cert_path.split("/")[-1], mime="application/pdf")
128
  for i, q in enumerate(module["quiz"]):
129
  st.markdown(f"**Q{i+1}: {q['question']}**")
130
  st.markdown(f"βœ… Correct Answer: `{q['answer']}`")
 
91
  safe_name = clean_filename(user_name)
92
  safe_topic = clean_filename(topic)
93
  filename = f"Certificate_{safe_name}_{safe_topic}.pdf"
94
+ pdf.output(filename)
95
+ return filename
 
96
 
97
  # ------------------------------
98
  # Quiz UI
 
123
  st.balloons()
124
  cert_path = generate_certificate(user_name, score, topic)
125
  st.markdown("### πŸŽ“ Download Your Certificate")
126
+ st.download_button("πŸ“„ Download Certificate", data=open(cert_path, "rb"), file_name=cert_path, mime="application/pdf")
127
  for i, q in enumerate(module["quiz"]):
128
  st.markdown(f"**Q{i+1}: {q['question']}**")
129
  st.markdown(f"βœ… Correct Answer: `{q['answer']}`")