JSenkCC commited on
Commit
8e137a6
·
verified ·
1 Parent(s): badcec3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -18
app.py CHANGED
@@ -503,39 +503,27 @@ def generate_documentation_page():
503
  pdf_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.pdf")
504
  markdown_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.md")
505
 
506
- # Show appropriate buttons based on file generation status
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 generated successfully!")
512
  except Exception as e:
513
  st.error(f"Failed to generate PDF: {e}")
514
  else:
515
- with open(pdf_path, "rb") as pdf_file:
516
- st.download_button(
517
- label="Download PDF",
518
- data=pdf_file.read(),
519
- file_name=f"{st.session_state.current_project}_Documentation.pdf",
520
- mime="application/pdf",
521
- )
522
 
 
523
  if not os.path.exists(markdown_path):
524
  if st.button("Generate Markdown File"):
525
  try:
526
  generate_markdown_file(documentation, markdown_path)
527
- st.success("Markdown file generated successfully!")
528
  except Exception as e:
529
  st.error(f"Failed to generate Markdown file: {e}")
530
  else:
531
- with open(markdown_path, "rb") as markdown_file:
532
- st.download_button(
533
- label="Download Markdown File",
534
- data=markdown_file.read(),
535
- file_name=f"{st.session_state.current_project}_Documentation.md",
536
- mime="text/markdown",
537
- )
538
-
539
 
540
 
541
 
 
503
  pdf_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.pdf")
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}")
514
  else:
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}")
525
  else:
526
+ st.success("Markdown has already been generated! Check the 'Saved Documentation' Page.")
 
 
 
 
 
 
 
527
 
528
 
529