Update app.py
Browse files
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 |
-
|
| 95 |
-
|
| 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
|
| 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']}`")
|