Update app.py
Browse files
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 |
-
#
|
| 140 |
if st.session_state.workshop_topic.strip() == "":
|
| 141 |
-
st.warning("Please enter a strategic workshop focus")
|
| 142 |
-
|
|
|
|
| 143 |
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
# Voice selection
|
| 152 |
-
if include_voiceover:
|
| 153 |
-
st.subheader("ποΈ Voice Selection")
|
| 154 |
-
voices = voiceover_agent.get_voices()
|
| 155 |
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 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.
|
| 304 |
-
st.
|
| 305 |
-
st.
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
<
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
</
|
| 312 |
-
|
| 313 |
-
<
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
</
|
| 317 |
-
|
| 318 |
-
<
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
</
|
|
|
|
| 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.
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 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 |
+
""")
|