Update app.py
Browse files
app.py
CHANGED
@@ -104,6 +104,10 @@ st.markdown("""
|
|
104 |
.stAlert {
|
105 |
border-radius: 10px;
|
106 |
}
|
|
|
|
|
|
|
|
|
107 |
</style>
|
108 |
""", unsafe_allow_html=True)
|
109 |
|
@@ -127,8 +131,18 @@ if 'voiceovers' not in st.session_state:
|
|
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 '
|
131 |
-
st.session_state.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
# Sidebar configuration
|
134 |
with st.sidebar:
|
@@ -140,63 +154,105 @@ with st.sidebar:
|
|
140 |
st.session_state.workshop_topic,
|
141 |
help="Strategic business topic (e.g., 'AI for Financial Services Transformation')"
|
142 |
)
|
143 |
-
|
144 |
-
#
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
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 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
|
|
|
|
|
|
|
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
# Generation pipeline
|
186 |
-
if st.session_state.generating and
|
187 |
with st.spinner(f"π Creating your executive workshop on '{st.session_state.workshop_topic}'..."):
|
188 |
start_time = time.time()
|
189 |
|
190 |
# Agent pipeline
|
191 |
-
outline = topic_agent.generate_outline(
|
|
|
|
|
|
|
|
|
192 |
content = content_agent.generate_content(outline)
|
193 |
slides = slide_agent.generate_slides(content)
|
194 |
-
code_labs = code_agent.generate_code(content) if include_code else None
|
195 |
-
design_url = design_agent.generate_design(slides) if include_design else None
|
196 |
|
197 |
# Generate voiceovers if enabled
|
198 |
voiceovers = {}
|
199 |
-
if include_voiceover and voiceover_agent.api_key:
|
200 |
for i, module in enumerate(content.get("modules", [])):
|
201 |
intro_text = f"Module {i+1}: {module['title']}. " + \
|
202 |
f"Key concepts: {', '.join(module.get('learning_points', [''])[:3])}"
|
@@ -238,7 +294,7 @@ if st.session_state.generating and st.session_state.show_config:
|
|
238 |
st.session_state.generating = False
|
239 |
|
240 |
# Results display
|
241 |
-
if st.session_state.generated and
|
242 |
st.success(f"β
Executive workshop generated in {st.session_state.gen_time} seconds!")
|
243 |
|
244 |
# Download button
|
@@ -307,33 +363,32 @@ if st.session_state.generated and st.session_state.show_config:
|
|
307 |
st.audio(audio_bytes, format="audio/mp3")
|
308 |
|
309 |
# Executive engagement section
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
<
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
<
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
<
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
</div>
|
330 |
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
|
338 |
# Testimonials
|
339 |
st.divider()
|
@@ -367,25 +422,24 @@ st.markdown("""
|
|
367 |
|
368 |
# Debug info
|
369 |
with st.sidebar:
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
""")
|
|
|
104 |
.stAlert {
|
105 |
border-radius: 10px;
|
106 |
}
|
107 |
+
.disabled-widget {
|
108 |
+
opacity: 0.6;
|
109 |
+
pointer-events: none;
|
110 |
+
}
|
111 |
</style>
|
112 |
""", unsafe_allow_html=True)
|
113 |
|
|
|
131 |
st.session_state.voiceovers = {}
|
132 |
if 'selected_voice' not in st.session_state:
|
133 |
st.session_state.selected_voice = "21m00Tcm4TlvDq8ikWAM" # Default voice ID
|
134 |
+
if 'duration' not in st.session_state:
|
135 |
+
st.session_state.duration = 4.0
|
136 |
+
if 'difficulty' not in st.session_state:
|
137 |
+
st.session_state.difficulty = "C-Suite"
|
138 |
+
if 'include_code' not in st.session_state:
|
139 |
+
st.session_state.include_code = True
|
140 |
+
if 'include_design' not in st.session_state:
|
141 |
+
st.session_state.include_design = True
|
142 |
+
if 'include_voiceover' not in st.session_state:
|
143 |
+
st.session_state.include_voiceover = True
|
144 |
+
if 'premium_mode' not in st.session_state:
|
145 |
+
st.session_state.premium_mode = True
|
146 |
|
147 |
# Sidebar configuration
|
148 |
with st.sidebar:
|
|
|
154 |
st.session_state.workshop_topic,
|
155 |
help="Strategic business topic (e.g., 'AI for Financial Services Transformation')"
|
156 |
)
|
157 |
+
|
158 |
+
# Check if topic is empty
|
159 |
+
topic_empty = st.session_state.workshop_topic.strip() == ""
|
160 |
+
|
161 |
+
# Show warning if topic is empty
|
162 |
+
if topic_empty:
|
163 |
+
st.warning("Please enter a strategic workshop focus to enable configuration")
|
164 |
+
|
165 |
+
# Always show config controls but disable when topic is empty
|
166 |
+
st.session_state.duration = st.slider(
|
167 |
+
"Duration (hours)",
|
168 |
+
2.0, 8.0, st.session_state.duration, 0.5,
|
169 |
+
help="Full-day or half-day workshop",
|
170 |
+
disabled=topic_empty
|
171 |
+
)
|
172 |
+
|
173 |
+
st.session_state.difficulty = st.selectbox(
|
174 |
+
"Audience Level",
|
175 |
+
["C-Suite", "Executives", "Directors", "Managers"],
|
176 |
+
index=["C-Suite", "Executives", "Directors", "Managers"].index(st.session_state.difficulty),
|
177 |
+
disabled=topic_empty
|
178 |
+
)
|
179 |
+
|
180 |
+
st.session_state.include_code = st.checkbox(
|
181 |
+
"Include Technical Implementation",
|
182 |
+
st.session_state.include_code,
|
183 |
+
disabled=topic_empty
|
184 |
+
)
|
185 |
+
|
186 |
+
st.session_state.include_design = st.checkbox(
|
187 |
+
"Generate Premium Visuals",
|
188 |
+
st.session_state.include_design,
|
189 |
+
disabled=topic_empty
|
190 |
+
)
|
191 |
+
|
192 |
+
st.session_state.include_voiceover = st.checkbox(
|
193 |
+
"Generate Voiceovers",
|
194 |
+
st.session_state.include_voiceover,
|
195 |
+
disabled=topic_empty
|
196 |
+
)
|
197 |
+
|
198 |
+
# Voice selection
|
199 |
+
if st.session_state.include_voiceover and not topic_empty:
|
200 |
+
st.subheader("ποΈ Voice Selection")
|
201 |
+
voices = voiceover_agent.get_voices()
|
202 |
|
203 |
+
if voices:
|
204 |
+
selected_voice = st.selectbox(
|
205 |
+
"Choose a voice:",
|
206 |
+
options=[v['voice_id'] for v in voices],
|
207 |
+
format_func=lambda id: next((v['name'] for v in voices if v['voice_id'] == id), "Default"),
|
208 |
+
key="voice_select"
|
209 |
+
)
|
210 |
+
st.session_state.selected_voice = selected_voice
|
211 |
+
elif voiceover_agent.api_key:
|
212 |
+
st.warning("Couldn't load voices. Using default voice.")
|
213 |
+
else:
|
214 |
+
st.warning("ElevenLabs API key not set. Voiceovers disabled.")
|
|
|
|
|
|
|
|
|
215 |
|
216 |
+
# Quality assurance checkbox
|
217 |
+
st.divider()
|
218 |
+
st.markdown("**Quality Assurance**")
|
219 |
+
st.session_state.premium_mode = st.checkbox(
|
220 |
+
"Enable Premium Mode",
|
221 |
+
st.session_state.premium_mode,
|
222 |
+
help="Generate boardroom-quality content with real-world case studies",
|
223 |
+
disabled=topic_empty
|
224 |
+
)
|
225 |
|
226 |
+
# Generate button - disabled when topic is empty
|
227 |
+
generate_disabled = topic_empty or st.session_state.generating
|
228 |
+
if st.button(
|
229 |
+
"β¨ Generate Premium Workshop",
|
230 |
+
type="primary",
|
231 |
+
use_container_width=True,
|
232 |
+
disabled=generate_disabled
|
233 |
+
):
|
234 |
+
st.session_state.generating = True
|
235 |
+
st.session_state.voiceovers = {} # Reset previous voiceovers
|
236 |
|
237 |
# Generation pipeline
|
238 |
+
if st.session_state.generating and not topic_empty:
|
239 |
with st.spinner(f"π Creating your executive workshop on '{st.session_state.workshop_topic}'..."):
|
240 |
start_time = time.time()
|
241 |
|
242 |
# Agent pipeline
|
243 |
+
outline = topic_agent.generate_outline(
|
244 |
+
st.session_state.workshop_topic,
|
245 |
+
st.session_state.duration,
|
246 |
+
st.session_state.difficulty
|
247 |
+
)
|
248 |
content = content_agent.generate_content(outline)
|
249 |
slides = slide_agent.generate_slides(content)
|
250 |
+
code_labs = code_agent.generate_code(content) if st.session_state.include_code else None
|
251 |
+
design_url = design_agent.generate_design(slides) if st.session_state.include_design else None
|
252 |
|
253 |
# Generate voiceovers if enabled
|
254 |
voiceovers = {}
|
255 |
+
if st.session_state.include_voiceover and voiceover_agent.api_key:
|
256 |
for i, module in enumerate(content.get("modules", [])):
|
257 |
intro_text = f"Module {i+1}: {module['title']}. " + \
|
258 |
f"Key concepts: {', '.join(module.get('learning_points', [''])[:3])}"
|
|
|
294 |
st.session_state.generating = False
|
295 |
|
296 |
# Results display
|
297 |
+
if st.session_state.generated and not topic_empty:
|
298 |
st.success(f"β
Executive workshop generated in {st.session_state.gen_time} seconds!")
|
299 |
|
300 |
# Download button
|
|
|
363 |
st.audio(audio_bytes, format="audio/mp3")
|
364 |
|
365 |
# Executive engagement section
|
366 |
+
st.divider()
|
367 |
+
st.subheader("π Premium Corporate Offering")
|
368 |
+
st.markdown(f"""
|
369 |
+
### {st.session_state.workshop_topic} Executive Program
|
370 |
+
<div class="pricing-card">
|
371 |
+
<h4>Live Workshop</h4>
|
372 |
+
<h2>$15,000</h2>
|
373 |
+
<p>Full-day session with Q&A</p>
|
374 |
+
</div>
|
375 |
+
<div class="pricing-card">
|
376 |
+
<h4>On-Demand Course</h4>
|
377 |
+
<h2>$7,500</h2>
|
378 |
+
<p>Enterprise-wide access</p>
|
379 |
+
</div>
|
380 |
+
<div class="pricing-card">
|
381 |
+
<h4>Implementation Package</h4>
|
382 |
+
<h2>$12,500</h2>
|
383 |
+
<p>Technical integration support</p>
|
384 |
+
</div>
|
|
|
385 |
|
386 |
+
**Premium Features:**
|
387 |
+
- Customized to your industry vertical
|
388 |
+
- ROI guarantee
|
389 |
+
- 12-month support agreement
|
390 |
+
- Executive briefing package
|
391 |
+
""", unsafe_allow_html=True)
|
392 |
|
393 |
# Testimonials
|
394 |
st.divider()
|
|
|
422 |
|
423 |
# Debug info
|
424 |
with st.sidebar:
|
425 |
+
st.divider()
|
426 |
+
if hasattr(topic_agent, 'openai_client') and topic_agent.openai_client:
|
427 |
+
st.success("OpenAI API Connected")
|
428 |
+
else:
|
429 |
+
st.warning("OpenAI API not set - using enhanced mock data")
|
430 |
+
|
431 |
+
if voiceover_agent.api_key:
|
432 |
+
st.success("ElevenLabs API Key Found")
|
433 |
+
elif st.session_state.include_voiceover:
|
434 |
+
st.warning("ElevenLabs API key not set")
|
435 |
+
|
436 |
+
st.info(f"""
|
437 |
+
**Current Workshop:**
|
438 |
+
{st.session_state.workshop_topic}
|
439 |
+
|
440 |
+
**Premium Features:**
|
441 |
+
- AI-generated voiceovers
|
442 |
+
- Professional slide designs
|
443 |
+
- Real-world case studies
|
444 |
+
- Practical code labs
|
445 |
+
""")
|
|