mgbam commited on
Commit
8d9233d
Β·
verified Β·
1 Parent(s): 954f7bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +90 -76
app.py CHANGED
@@ -101,6 +101,9 @@ st.markdown("""
101
  margin-bottom: 25px;
102
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
103
  }
 
 
 
104
  </style>
105
  """, unsafe_allow_html=True)
106
 
@@ -124,6 +127,8 @@ if 'voiceovers' not in st.session_state:
124
  st.session_state.voiceovers = {}
125
  if 'selected_voice' not in st.session_state:
126
  st.session_state.selected_voice = "21m00Tcm4TlvDq8ikWAM" # Default voice ID
 
 
127
 
128
  # Sidebar configuration
129
  with st.sidebar:
@@ -136,47 +141,49 @@ with st.sidebar:
136
  help="Strategic business topic (e.g., 'AI for Financial Services Transformation')"
137
  )
138
 
139
- # Validate topic input
140
  if st.session_state.workshop_topic.strip() == "":
141
- st.warning("Please enter a strategic workshop focus")
142
- st.stop()
 
143
 
144
- duration = st.slider("Duration (hours)", 2.0, 8.0, 4.0, 0.5, help="Full-day or half-day workshop")
145
- difficulty = st.selectbox("Audience Level",
146
- ["C-Suite", "Executives", "Directors", "Managers"])
147
- include_code = st.checkbox("Include Technical Implementation", True)
148
- include_design = st.checkbox("Generate Premium Visuals", True)
149
- include_voiceover = st.checkbox("Generate Voiceovers", True)
150
-
151
- # Voice selection
152
- if include_voiceover:
153
- st.subheader("πŸŽ™οΈ Voice Selection")
154
- voices = voiceover_agent.get_voices()
155
 
156
- if voices:
157
- selected_voice = st.selectbox(
158
- "Choose a voice:",
159
- options=[v['voice_id'] for v in voices],
160
- format_func=lambda id: next((v['name'] for v in voices if v['voice_id'] == id), "Default")
161
- )
162
- st.session_state.selected_voice = selected_voice
163
- elif voiceover_agent.api_key:
164
- st.warning("Couldn't load voices. Using default voice.")
165
- else:
166
- st.warning("ElevenLabs API key not set. Voiceovers disabled.")
 
 
 
 
 
167
 
168
- # Quality assurance checkbox
169
- st.divider()
170
- st.markdown("**Quality Assurance**")
171
- premium_mode = st.checkbox("Enable Premium Mode", True,
172
- help="Generate boardroom-quality content with real-world case studies")
173
 
174
- if st.button("✨ Generate Premium Workshop", type="primary", use_container_width=True):
175
- st.session_state.generating = True
176
- st.session_state.voiceovers = {} # Reset previous voiceovers
177
 
178
  # Generation pipeline
179
- if st.session_state.generating:
180
  with st.spinner(f"πŸš€ Creating your executive workshop on '{st.session_state.workshop_topic}'..."):
181
  start_time = time.time()
182
 
@@ -231,7 +238,7 @@ if st.session_state.generating:
231
  st.session_state.generating = False
232
 
233
  # Results display
234
- if st.session_state.generated:
235
  st.success(f"βœ… Executive workshop generated in {st.session_state.gen_time} seconds!")
236
 
237
  # Download button
@@ -300,32 +307,33 @@ if st.session_state.generated:
300
  st.audio(audio_bytes, format="audio/mp3")
301
 
302
  # Executive engagement section
303
- st.divider()
304
- st.subheader("πŸš€ Premium Corporate Offering")
305
- st.markdown(f"""
306
- ### {st.session_state.workshop_topic} Executive Program
307
- <div class="pricing-card">
308
- <h4>Live Workshop</h4>
309
- <h2>$15,000</h2>
310
- <p>Full-day session with Q&A</p>
311
- </div>
312
- <div class="pricing-card">
313
- <h4>On-Demand Course</h4>
314
- <h2>$7,500</h2>
315
- <p>Enterprise-wide access</p>
316
- </div>
317
- <div class="pricing-card">
318
- <h4>Implementation Package</h4>
319
- <h2>$12,500</h2>
320
- <p>Technical integration support</p>
321
- </div>
 
322
 
323
- **Premium Features:**
324
- - Customized to your industry vertical
325
- - ROI guarantee
326
- - 12-month support agreement
327
- - Executive briefing package
328
- """, unsafe_allow_html=True)
329
 
330
  # Testimonials
331
  st.divider()
@@ -359,19 +367,25 @@ st.markdown("""
359
 
360
  # Debug info
361
  with st.sidebar:
362
- st.divider()
363
- if hasattr(voiceover_agent, 'api_key') and voiceover_agent.api_key:
364
- st.success("ElevenLabs API Key Found")
365
- elif include_voiceover:
366
- st.warning("ElevenLabs API key not set")
367
-
368
- st.info(f"""
369
- **Current Workshop:**
370
- {st.session_state.workshop_topic}
371
-
372
- **Premium Features:**
373
- - AI-generated voiceovers
374
- - Professional slide designs
375
- - Fortune 500 case studies
376
- - Practical code labs
377
- """)
 
 
 
 
 
 
 
101
  margin-bottom: 25px;
102
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
103
  }
104
+ .stAlert {
105
+ border-radius: 10px;
106
+ }
107
  </style>
108
  """, unsafe_allow_html=True)
109
 
 
127
  st.session_state.voiceovers = {}
128
  if 'selected_voice' not in st.session_state:
129
  st.session_state.selected_voice = "21m00Tcm4TlvDq8ikWAM" # Default voice ID
130
+ if 'show_config' not in st.session_state:
131
+ st.session_state.show_config = False
132
 
133
  # Sidebar configuration
134
  with st.sidebar:
 
141
  help="Strategic business topic (e.g., 'AI for Financial Services Transformation')"
142
  )
143
 
144
+ # Only show config if topic is provided
145
  if st.session_state.workshop_topic.strip() == "":
146
+ st.warning("Please enter a strategic workshop focus to continue")
147
+ else:
148
+ st.session_state.show_config = True
149
 
150
+ if st.session_state.show_config:
151
+ duration = st.slider("Duration (hours)", 2.0, 8.0, 4.0, 0.5, help="Full-day or half-day workshop")
152
+ difficulty = st.selectbox("Audience Level",
153
+ ["C-Suite", "Executives", "Directors", "Managers"])
154
+ include_code = st.checkbox("Include Technical Implementation", True)
155
+ include_design = st.checkbox("Generate Premium Visuals", True)
156
+ include_voiceover = st.checkbox("Generate Voiceovers", True)
 
 
 
 
157
 
158
+ # Voice selection
159
+ if include_voiceover:
160
+ st.subheader("πŸŽ™οΈ Voice Selection")
161
+ voices = voiceover_agent.get_voices()
162
+
163
+ if voices:
164
+ selected_voice = st.selectbox(
165
+ "Choose a voice:",
166
+ options=[v['voice_id'] for v in voices],
167
+ format_func=lambda id: next((v['name'] for v in voices if v['voice_id'] == id), "Default")
168
+ )
169
+ st.session_state.selected_voice = selected_voice
170
+ elif voiceover_agent.api_key:
171
+ st.warning("Couldn't load voices. Using default voice.")
172
+ else:
173
+ st.warning("ElevenLabs API key not set. Voiceovers disabled.")
174
 
175
+ # Quality assurance checkbox
176
+ st.divider()
177
+ st.markdown("**Quality Assurance**")
178
+ premium_mode = st.checkbox("Enable Premium Mode", True,
179
+ help="Generate boardroom-quality content with real-world case studies")
180
 
181
+ if st.button("✨ Generate Premium Workshop", type="primary", use_container_width=True):
182
+ st.session_state.generating = True
183
+ st.session_state.voiceovers = {} # Reset previous voiceovers
184
 
185
  # Generation pipeline
186
+ if st.session_state.generating and st.session_state.show_config:
187
  with st.spinner(f"πŸš€ Creating your executive workshop on '{st.session_state.workshop_topic}'..."):
188
  start_time = time.time()
189
 
 
238
  st.session_state.generating = False
239
 
240
  # Results display
241
+ if st.session_state.generated and st.session_state.show_config:
242
  st.success(f"βœ… Executive workshop generated in {st.session_state.gen_time} seconds!")
243
 
244
  # Download button
 
307
  st.audio(audio_bytes, format="audio/mp3")
308
 
309
  # Executive engagement section
310
+ if st.session_state.show_config:
311
+ st.divider()
312
+ st.subheader("πŸš€ Premium Corporate Offering")
313
+ st.markdown(f"""
314
+ ### {st.session_state.workshop_topic} Executive Program
315
+ <div class="pricing-card">
316
+ <h4>Live Workshop</h4>
317
+ <h2>$15,000</h2>
318
+ <p>Full-day session with Q&A</p>
319
+ </div>
320
+ <div class="pricing-card">
321
+ <h4>On-Demand Course</h4>
322
+ <h2>$7,500</h2>
323
+ <p>Enterprise-wide access</p>
324
+ </div>
325
+ <div class="pricing-card">
326
+ <h4>Implementation Package</h4>
327
+ <h2>$12,500</h2>
328
+ <p>Technical integration support</p>
329
+ </div>
330
 
331
+ **Premium Features:**
332
+ - Customized to your industry vertical
333
+ - ROI guarantee
334
+ - 12-month support agreement
335
+ - Executive briefing package
336
+ """, unsafe_allow_html=True)
337
 
338
  # Testimonials
339
  st.divider()
 
367
 
368
  # Debug info
369
  with st.sidebar:
370
+ if st.session_state.show_config:
371
+ st.divider()
372
+ if hasattr(topic_agent, 'openai_client') and topic_agent.openai_client:
373
+ st.success("OpenAI API Connected")
374
+ else:
375
+ st.warning("OpenAI API not set - using enhanced mock data")
376
+
377
+ if voiceover_agent.api_key:
378
+ st.success("ElevenLabs API Key Found")
379
+ elif include_voiceover:
380
+ st.warning("ElevenLabs API key not set")
381
+
382
+ st.info(f"""
383
+ **Current Workshop:**
384
+ {st.session_state.workshop_topic}
385
+
386
+ **Premium Features:**
387
+ - AI-generated voiceovers
388
+ - Professional slide designs
389
+ - Real-world case studies
390
+ - Practical code labs
391
+ """)