Spaces:
Runtime error
Runtime error
Add sidebar with PPT template selection
Browse files- chat_app.py +11 -3
chat_app.py
CHANGED
@@ -22,6 +22,15 @@ APP_TEXT = json5.loads(open(GlobalConfig.APP_STRINGS_FILE, 'r', encoding='utf-8'
|
|
22 |
logger = logging.getLogger(__name__)
|
23 |
progress_bar = st.progress(0, text='Setting up SlideDeck AI...')
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
def display_page_header_content():
|
27 |
"""
|
@@ -138,16 +147,15 @@ def set_up_chat_ui():
|
|
138 |
|
139 |
# Now create the PPT file
|
140 |
progress_bar_pptx.progress(75, 'Creating the slide deck...give it a moment')
|
141 |
-
generate_slide_deck(response_cleaned
|
142 |
progress_bar_pptx.progress(100, text='Done!')
|
143 |
|
144 |
|
145 |
-
def generate_slide_deck(json_str: str
|
146 |
"""
|
147 |
Create a slide deck.
|
148 |
|
149 |
:param json_str: The content in *valid* JSON format.
|
150 |
-
:param pptx_template: The PPTX template name.
|
151 |
:return: A list of all slide headers and the title.
|
152 |
"""
|
153 |
|
|
|
22 |
logger = logging.getLogger(__name__)
|
23 |
progress_bar = st.progress(0, text='Setting up SlideDeck AI...')
|
24 |
|
25 |
+
texts = list(GlobalConfig.PPTX_TEMPLATE_FILES.keys())
|
26 |
+
captions = [GlobalConfig.PPTX_TEMPLATE_FILES[x]['caption'] for x in texts]
|
27 |
+
pptx_template = st.sidebar.radio(
|
28 |
+
'Select a presentation template:',
|
29 |
+
texts,
|
30 |
+
captions=captions,
|
31 |
+
horizontal=True
|
32 |
+
)
|
33 |
+
|
34 |
|
35 |
def display_page_header_content():
|
36 |
"""
|
|
|
147 |
|
148 |
# Now create the PPT file
|
149 |
progress_bar_pptx.progress(75, 'Creating the slide deck...give it a moment')
|
150 |
+
generate_slide_deck(response_cleaned)
|
151 |
progress_bar_pptx.progress(100, text='Done!')
|
152 |
|
153 |
|
154 |
+
def generate_slide_deck(json_str: str) -> List:
|
155 |
"""
|
156 |
Create a slide deck.
|
157 |
|
158 |
:param json_str: The content in *valid* JSON format.
|
|
|
159 |
:return: A list of all slide headers and the title.
|
160 |
"""
|
161 |
|