File size: 12,942 Bytes
af64a0f a90e972 4726c28 d07300c af64a0f f0d7cfb af64a0f a90e972 d07300c a90e972 4726c28 a90e972 af64a0f 4726c28 a90e972 4726c28 a90e972 4726c28 a90e972 3ee401e a90e972 4726c28 a90e972 4726c28 a90e972 4726c28 a90e972 4726c28 a90e972 4726c28 a90e972 4726c28 d07300c 4726c28 d07300c 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 c185f68 4726c28 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
import streamlit as st
import json
import zipfile
import io
import time
import textwrap
import base64
from agents import TopicAgent, ContentAgent, SlideAgent, CodeAgent, DesignAgent, VoiceoverAgent
# Initialize agents
topic_agent = TopicAgent()
content_agent = ContentAgent()
slide_agent = SlideAgent()
code_agent = CodeAgent()
design_agent = DesignAgent()
voiceover_agent = VoiceoverAgent()
# =====================
# STREAMLIT APPLICATION
# =====================
st.set_page_config(
page_title="Workshop in a Box Pro",
layout="wide",
initial_sidebar_state="expanded",
page_icon="๐"
)
# Custom CSS for premium styling
st.markdown("""
<style>
.stApp {
background: linear-gradient(135deg, #0f2027 0%, #203a43 100%);
color: #fff;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.stTextInput>div>div>input {
background-color: rgba(255,255,255,0.1) !important;
color: white !important;
border: 1px solid #4CAF50;
border-radius: 8px;
}
.stButton>button {
background: linear-gradient(to right, #0d8bf2, #04befe) !important;
color: white !important;
border: none;
border-radius: 8px;
padding: 12px 30px;
font-size: 16px;
font-weight: bold;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: all 0.3s ease;
}
.stButton>button:hover {
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}
.stDownloadButton>button {
background: linear-gradient(to right, #00c853, #64dd17) !important;
}
.stExpander {
background: rgba(15, 32, 39, 0.8) !important;
border-radius: 10px;
padding: 20px;
border: 1px solid #1e88e5;
box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.premium-badge {
background: linear-gradient(45deg, #ffd700, #ff9800);
color: #000;
padding: 3px 10px;
border-radius: 12px;
font-size: 0.8em;
font-weight: bold;
display: inline-block;
margin-left: 10px;
}
.section-header {
border-left: 4px solid #0d8bf2;
padding-left: 15px;
margin-top: 30px;
}
.testimonial {
background: rgba(255,255,255,0.05);
border-radius: 10px;
padding: 15px;
margin: 15px 0;
border-left: 4px solid #00c853;
}
.pricing-card {
background: rgba(255,255,255,0.05);
border-radius: 10px;
padding: 20px;
margin: 10px 0;
border: 1px solid #0d8bf2;
}
</style>
""", unsafe_allow_html=True)
# Header
col1, col2 = st.columns([1, 4])
with col1:
st.image("https://cdn-icons-png.flaticon.com/512/1995/1995485.png", width=80)
with col2:
st.title("๐ค Workshop in a Box Pro")
st.markdown("Generate Boardroom-Quality Corporate Training <span class='premium-badge'>PREMIUM</span>", unsafe_allow_html=True)
st.caption("Create $10K+ Value Workshops in Minutes")
# Initialize session state
if 'workshop_topic' not in st.session_state:
st.session_state.workshop_topic = "AI-Driven Business Transformation"
if 'generated' not in st.session_state:
st.session_state.generated = False
if 'generating' not in st.session_state:
st.session_state.generating = False
if 'voiceovers' not in st.session_state:
st.session_state.voiceovers = {}
if 'selected_voice' not in st.session_state:
st.session_state.selected_voice = "21m00Tcm4TlvDq8ikWAM" # Default voice ID
# Sidebar configuration
with st.sidebar:
st.header("โ๏ธ Executive Workshop Configuration")
# Workshop topic input
st.session_state.workshop_topic = st.text_input(
"Workshop Focus",
st.session_state.workshop_topic,
help="Strategic business topic (e.g., 'AI for Financial Services Transformation')"
)
# Validate topic input
if st.session_state.workshop_topic.strip() == "":
st.warning("Please enter a strategic workshop focus")
st.stop()
duration = st.slider("Duration (hours)", 2.0, 8.0, 4.0, 0.5, help="Full-day or half-day workshop")
difficulty = st.selectbox("Audience Level",
["C-Suite", "Executives", "Directors", "Managers"])
include_code = st.checkbox("Include Technical Implementation", True)
include_design = st.checkbox("Generate Premium Visuals", True)
include_voiceover = st.checkbox("Generate Voiceovers", True)
# Voice selection
if include_voiceover:
st.subheader("๐๏ธ Voice Selection")
voices = voiceover_agent.get_voices()
if voices:
selected_voice = st.selectbox(
"Choose a voice:",
options=[v['voice_id'] for v in voices],
format_func=lambda id: next((v['name'] for v in voices if v['voice_id'] == id), "Default")
st.session_state.selected_voice = selected_voice
elif voiceover_agent.api_key:
st.warning("Couldn't load voices. Using default voice.")
else:
st.warning("ElevenLabs API key not set. Voiceovers disabled.")
# Quality assurance checkbox
st.divider()
st.markdown("**Quality Assurance**")
premium_mode = st.checkbox("Enable Premium Mode", True,
help="Generate boardroom-quality content with real-world case studies")
if st.button("โจ Generate Premium Workshop", type="primary", use_container_width=True):
st.session_state.generating = True
st.session_state.voiceovers = {} # Reset previous voiceovers
# Generation pipeline
if st.session_state.generating:
with st.spinner(f"๐ Creating your executive workshop on '{st.session_state.workshop_topic}'..."):
start_time = time.time()
# Agent pipeline
outline = topic_agent.generate_outline(st.session_state.workshop_topic, duration, difficulty)
content = content_agent.generate_content(outline)
slides = slide_agent.generate_slides(content)
code_labs = code_agent.generate_code(content) if include_code else None
design_url = design_agent.generate_design(slides) if include_design else None
# Generate voiceovers if enabled
voiceovers = {}
if include_voiceover and voiceover_agent.api_key:
for i, module in enumerate(content.get("modules", [])):
intro_text = f"Module {i+1}: {module['title']}. " + \
f"Key concepts: {', '.join(module.get('learning_points', [''])[:3])}"
audio_data = voiceover_agent.generate_voiceover(
intro_text,
st.session_state.selected_voice
)
if audio_data:
voiceovers[f"module_{i+1}_intro.mp3"] = audio_data
# Prepare download package
zip_buffer = io.BytesIO()
with zipfile.ZipFile(zip_buffer, "a") as zip_file:
zip_file.writestr("executive_summary.json", json.dumps(outline, indent=2))
zip_file.writestr("workshop_content.json", json.dumps(content, indent=2))
zip_file.writestr("boardroom_slides.md", slides)
if code_labs:
zip_file.writestr("enterprise_solutions.ipynb", code_labs)
if design_url:
try:
img_data = requests.get(design_url).content
zip_file.writestr("slide_design.png", img_data)
except:
pass
# Add voiceovers to ZIP
for filename, audio_data in voiceovers.items():
zip_file.writestr(f"voiceovers/{filename}", audio_data)
# Store results
st.session_state.outline = outline
st.session_state.content = content
st.session_state.slides = slides
st.session_state.code_labs = code_labs
st.session_state.design_url = design_url
st.session_state.voiceovers = voiceovers
st.session_state.zip_buffer = zip_buffer
st.session_state.gen_time = round(time.time() - start_time, 2)
st.session_state.generated = True
st.session_state.generating = False
# Results display
if st.session_state.generated:
st.success(f"โ
Executive workshop generated in {st.session_state.gen_time} seconds!")
# Download button
st.download_button(
label="๐ฅ Download Executive Package",
data=st.session_state.zip_buffer.getvalue(),
file_name=f"{st.session_state.workshop_topic.replace(' ', '_')}_workshop.zip",
mime="application/zip",
use_container_width=True
)
# Executive summary
with st.expander("๐ Executive Overview", expanded=True):
st.subheader(st.session_state.outline.get("title", "Strategic Workshop"))
st.caption(f"Duration: {st.session_state.outline.get('duration', '4 hours')} | Level: {st.session_state.outline.get('difficulty', 'Executive')}")
st.markdown("**Business Value Proposition**")
if "learning_goals" in st.session_state.outline:
for goal in st.session_state.outline["learning_goals"]:
st.markdown(f"- {goal}")
st.markdown("**Key Deliverables**")
st.markdown("- Boardroom-ready presentation\n"
"- Implementation toolkit\n"
"- ROI calculation framework\n"
"- Enterprise integration guide")
# Workshop content
with st.expander("๐ Strategic Content Framework"):
if "modules" in st.session_state.content:
for module in st.session_state.content["modules"]:
st.subheader(module.get("title", "Business Module"))
st.markdown(module.get("script", ""))
st.markdown("**Executive Discussion Points**")
if "discussion_questions" in module:
for q in module["discussion_questions"]:
st.markdown(f"- **{q.get('question', '')}**")
st.caption(q.get("response", ""))
# Slide preview
with st.expander("๐ฅ๏ธ Boardroom Presentation Preview"):
st.markdown("```markdown\n" + textwrap.dedent(st.session_state.slides[:2000]) + "\n```")
# Technical implementation
if st.session_state.code_labs:
with st.expander("๐ป Enterprise Implementation Toolkit"):
st.code(st.session_state.code_labs)
# Design preview
if st.session_state.design_url:
with st.expander("๐จ Premium Visual Design"):
try:
st.image(st.session_state.design_url, caption="Corporate Slide Design")
except:
st.warning("Design preview unavailable")
# Voiceover player
if st.session_state.voiceovers:
with st.expander("๐ Voiceover Previews"):
for i, (filename, audio_bytes) in enumerate(st.session_state.voiceovers.items()):
module_num = filename.split("_")[1]
st.subheader(f"Module {module_num} Introduction")
st.audio(audio_bytes, format="audio/mp3")
# Executive engagement section
st.divider()
st.subheader("๐ Premium Corporate Offering")
st.markdown(f"""
### {st.session_state.workshop_topic} Executive Program
<div class="pricing-card">
<h4>Live Workshop</h4>
<h2>$15,000</h2>
<p>Full-day session with Q&A</p>
</div>
<div class="pricing-card">
<h4>On-Demand Course</h4>
<h2>$7,500</h2>
<p>Enterprise-wide access</p>
</div>
<div class="pricing-card">
<h4>Implementation Package</h4>
<h2>$12,500</h2>
<p>Technical integration support</p>
</div>
**Premium Features:**
- Customized to your industry vertical
- ROI guarantee
- 12-month support agreement
- Executive briefing package
""", unsafe_allow_html=True)
# Testimonials
st.divider()
st.subheader("๐ผ Executive Testimonials")
st.markdown("""
<div class="testimonial">
<p>"This platform helped us create a $50K training program in one afternoon. The ROI was immediate."</p>
<p><strong>โ Sarah Johnson, CLO at FinTech Global</strong></p>
</div>
<div class="testimonial">
<p>"The boardroom-quality materials impressed our clients and justified our premium pricing."</p>
<p><strong>โ Michael Chen, Partner at McKinsey & Company</strong></p>
</div>
""", unsafe_allow_html=True)
# CTA
st.divider()
col1, col2 = st.columns(2)
with col1:
st.link_button("๐
Book Strategy Session", "https://calendly.com/your-link", use_container_width=True)
with col2:
st.link_button("๐ผ Enterprise Solutions", "https://your-company.com/enterprise", use_container_width=True)
# Footer
st.divider()
st.markdown("""
<div style="text-align: center; padding: 20px; color: #aaa;">
Workshop in a Box Proยฎ | Enterprise-Grade AI Training Solutions | ยฉ 2025
</div>
""", unsafe_allow_html=True) |