|
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 |
|
|
|
|
|
topic_agent = TopicAgent() |
|
content_agent = ContentAgent() |
|
slide_agent = SlideAgent() |
|
code_agent = CodeAgent() |
|
design_agent = DesignAgent() |
|
voiceover_agent = VoiceoverAgent() |
|
|
|
|
|
|
|
|
|
|
|
st.set_page_config( |
|
page_title="Workshop in a Box Pro", |
|
layout="wide", |
|
initial_sidebar_state="expanded", |
|
page_icon="๐" |
|
) |
|
|
|
|
|
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) |
|
|
|
|
|
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") |
|
|
|
|
|
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" |
|
|
|
|
|
with st.sidebar: |
|
st.header("โ๏ธ Executive Workshop Configuration") |
|
|
|
|
|
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')" |
|
) |
|
|
|
|
|
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) |
|
|
|
|
|
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.") |
|
|
|
|
|
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 = {} |
|
|
|
|
|
if st.session_state.generating: |
|
with st.spinner(f"๐ Creating your executive workshop on '{st.session_state.workshop_topic}'..."): |
|
start_time = time.time() |
|
|
|
|
|
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 |
|
|
|
|
|
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 |
|
|
|
|
|
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 |
|
|
|
for filename, audio_data in voiceovers.items(): |
|
zip_file.writestr(f"voiceovers/{filename}", audio_data) |
|
|
|
|
|
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 |
|
|
|
|
|
if st.session_state.generated: |
|
st.success(f"โ
Executive workshop generated in {st.session_state.gen_time} seconds!") |
|
|
|
|
|
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 |
|
) |
|
|
|
|
|
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") |
|
|
|
|
|
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", "")) |
|
|
|
|
|
with st.expander("๐ฅ๏ธ Boardroom Presentation Preview"): |
|
st.markdown("```markdown\n" + textwrap.dedent(st.session_state.slides[:2000]) + "\n```") |
|
|
|
|
|
if st.session_state.code_labs: |
|
with st.expander("๐ป Enterprise Implementation Toolkit"): |
|
st.code(st.session_state.code_labs) |
|
|
|
|
|
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") |
|
|
|
|
|
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") |
|
|
|
|
|
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) |
|
|
|
|
|
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) |
|
|
|
|
|
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) |
|
|
|
|
|
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) |