Update app.py
Browse files
app.py
CHANGED
@@ -504,10 +504,12 @@ def generate_documentation_page():
|
|
504 |
markdown_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.md")
|
505 |
|
506 |
# Generate PDF Button
|
507 |
-
if not os.path.exists(pdf_path):
|
508 |
if st.button("Generate PDF"):
|
509 |
try:
|
510 |
generate_pdf(documentation, pdf_path)
|
|
|
|
|
511 |
st.success("PDF Available in the 'Saved Documentation' Page.")
|
512 |
except Exception as e:
|
513 |
st.error(f"Failed to generate PDF: {e}")
|
@@ -515,10 +517,12 @@ def generate_documentation_page():
|
|
515 |
st.success("PDF has already been generated! Check the 'Saved Documentation' Page.")
|
516 |
|
517 |
# Generate Markdown Button
|
518 |
-
if not os.path.exists(markdown_path):
|
519 |
if st.button("Generate Markdown File"):
|
520 |
try:
|
521 |
generate_markdown_file(documentation, markdown_path)
|
|
|
|
|
522 |
st.success("Markdown Available in the 'Saved Documentation' Page.")
|
523 |
except Exception as e:
|
524 |
st.error(f"Failed to generate Markdown file: {e}")
|
|
|
504 |
markdown_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.md")
|
505 |
|
506 |
# Generate PDF Button
|
507 |
+
if not os.path.exists(pdf_path) and not pdf_generated:
|
508 |
if st.button("Generate PDF"):
|
509 |
try:
|
510 |
generate_pdf(documentation, pdf_path)
|
511 |
+
st.session_state.pdf_generated = True
|
512 |
+
st.rerun()
|
513 |
st.success("PDF Available in the 'Saved Documentation' Page.")
|
514 |
except Exception as e:
|
515 |
st.error(f"Failed to generate PDF: {e}")
|
|
|
517 |
st.success("PDF has already been generated! Check the 'Saved Documentation' Page.")
|
518 |
|
519 |
# Generate Markdown Button
|
520 |
+
if not os.path.exists(markdown_path) and not markdown_generated:
|
521 |
if st.button("Generate Markdown File"):
|
522 |
try:
|
523 |
generate_markdown_file(documentation, markdown_path)
|
524 |
+
st.session_state.markdown_generated = True # Set a flag for Markdown generation
|
525 |
+
st.rerun() # Trigger a rerun to show the download button
|
526 |
st.success("Markdown Available in the 'Saved Documentation' Page.")
|
527 |
except Exception as e:
|
528 |
st.error(f"Failed to generate Markdown file: {e}")
|