devuxious commited on
Commit
6a2f52a
·
verified ·
1 Parent(s): 3d31962

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -17
app.py CHANGED
@@ -45,7 +45,7 @@ def export_to_excel(study_plan, filename="study_plan.xlsx"):
45
 
46
  # Streamlit UI
47
  st.title("Personalized Study Assistant Chatbot")
48
- st.write("Generate a tailored study plan with actionable insights and export options.")
49
 
50
  # Input fields
51
  subject = st.text_input("Study Topic or Exam Subject", "IELTS")
@@ -58,19 +58,13 @@ if st.button("Generate Study Plan"):
58
  st.subheader("Generated Study Plan")
59
  st.text_area("Your Study Plan", study_plan, height=300)
60
 
61
- # Export options
62
- col1, col2 = st.columns(2)
63
-
64
- with col1:
65
- if st.button("Export to PDF"):
66
- pdf_file = export_to_pdf(study_plan)
67
- st.success(f"Study plan exported as {pdf_file}")
68
- with open(pdf_file, "rb") as file:
69
- st.download_button("Download PDF", file, file_name="study_plan.pdf", key="pdf_download")
70
-
71
- with col2:
72
- if st.button("Export to Excel"):
73
- excel_file = export_to_excel(study_plan)
74
- st.success(f"Study plan exported as {excel_file}")
75
- with open(excel_file, "rb") as file:
76
- st.download_button("Download Excel", file, file_name="study_plan.xlsx", key="excel_download")
 
45
 
46
  # Streamlit UI
47
  st.title("Personalized Study Assistant Chatbot")
48
+ st.write("Generate a tailored study plan with actionable insights and download options.")
49
 
50
  # Input fields
51
  subject = st.text_input("Study Topic or Exam Subject", "IELTS")
 
58
  st.subheader("Generated Study Plan")
59
  st.text_area("Your Study Plan", study_plan, height=300)
60
 
61
+ # File generation after study plan is created
62
+ pdf_file = export_to_pdf(study_plan)
63
+ excel_file = export_to_excel(study_plan)
64
+
65
+ # Create download buttons for both PDF and Excel
66
+ with open(pdf_file, "rb") as file:
67
+ st.download_button("Download PDF", file, file_name="study_plan.pdf", key="pdf_download")
68
+
69
+ with open(excel_file, "rb") as file:
70
+ st.download_button("Download Excel", file, file_name="study_plan.xlsx", key="excel_download")