yashm commited on
Commit
2ca4411
·
verified ·
1 Parent(s): ad30388

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -7
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import streamlit as st
3
  from pptx import Presentation
4
  from collections import OrderedDict
@@ -61,17 +60,36 @@ selected_template = templates[presentation_type]
61
 
62
  # Title slide configuration
63
  st.sidebar.header("Title Slide")
64
- title_slide_info = {
65
- 'title': st.sidebar.text_input("Title", "Your Presentation Title"),
66
- 'subtitle': st.sidebar.text_input("Subtitle", "Your Name"),
67
- 'institution': st.sidebar.text_input("Institution", "Your Institution"),
68
- 'date': st.sidebar.text_input("Date", "Presentation Date")
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  # Main page for sections and subsections configuration
72
  st.title('Customize Your Presentation')
73
  sections = OrderedDict()
74
 
 
75
  for section in selected_template:
76
  with st.expander(f"Section: {section['title']}"):
77
  subsections = OrderedDict()
@@ -80,6 +98,17 @@ for section in selected_template:
80
  subsections[content_title] = bullets
81
  sections[section['title']] = {'title': section['title'], 'subsections': subsections}
82
 
 
 
 
 
 
 
 
 
 
 
 
83
  # Generate and download presentation
84
  if st.button('Generate Presentation'):
85
  file_path = create_presentation(title_slide_info, sections)
 
 
1
  import streamlit as st
2
  from pptx import Presentation
3
  from collections import OrderedDict
 
60
 
61
  # Title slide configuration
62
  st.sidebar.header("Title Slide")
63
+ title_slide_preset = st.sidebar.selectbox("Choose Title Slide Preset", ["Custom", "Preset 1", "Preset 2"])
64
+ if title_slide_preset == "Custom":
65
+ title_slide_info = {
66
+ 'title': st.sidebar.text_input("Title", "Your Presentation Title"),
67
+ 'subtitle': st.sidebar.text_input("Subtitle", "Your Name"),
68
+ 'institution': st.sidebar.text_input("Institution", "Your Institution"),
69
+ 'date': st.sidebar.text_input("Date", "Presentation Date")
70
+ }
71
+ else:
72
+ # Add more presets as needed
73
+ if title_slide_preset == "Preset 1":
74
+ title_slide_info = {
75
+ 'title': "Preset Title 1",
76
+ 'subtitle': "Preset Subtitle 1",
77
+ 'institution': "Preset Institution 1",
78
+ 'date': "Preset Date 1"
79
+ }
80
+ elif title_slide_preset == "Preset 2":
81
+ title_slide_info = {
82
+ 'title': "Preset Title 2",
83
+ 'subtitle': "Preset Subtitle 2",
84
+ 'institution': "Preset Institution 2",
85
+ 'date': "Preset Date 2"
86
+ }
87
 
88
  # Main page for sections and subsections configuration
89
  st.title('Customize Your Presentation')
90
  sections = OrderedDict()
91
 
92
+ # Existing template sections
93
  for section in selected_template:
94
  with st.expander(f"Section: {section['title']}"):
95
  subsections = OrderedDict()
 
98
  subsections[content_title] = bullets
99
  sections[section['title']] = {'title': section['title'], 'subsections': subsections}
100
 
101
+ # Option to add more sections
102
+ if st.sidebar.button("Add More Section"):
103
+ new_section_title = st.sidebar.text_input("New Section Title", "New Section")
104
+ new_subsections = OrderedDict()
105
+ num_subsections = st.sidebar.number_input("Number of Subsections", min_value=1, step=1)
106
+ for i in range(num_subsections):
107
+ subsection_title = st.sidebar.text_input(f"Subsection Title {i+1}", f"New Subsection {i+1}")
108
+ bullet_points = st.sidebar.text_area(f"Bullet Points for {subsection_title}", height=100).split('\n')
109
+ new_subsections[subsection_title] = bullet_points
110
+ sections[new_section_title] = {'title': new_section_title, 'subsections': new_subsections}
111
+
112
  # Generate and download presentation
113
  if st.button('Generate Presentation'):
114
  file_path = create_presentation(title_slide_info, sections)