Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,18 +9,23 @@ st.set_page_config(
|
|
| 9 |
|
| 10 |
import uuid
|
| 11 |
import os
|
| 12 |
-
|
|
|
|
| 13 |
render_ideation_stage,
|
| 14 |
render_storyboard_stage,
|
| 15 |
render_template_stage,
|
| 16 |
render_slides_stage,
|
| 17 |
-
render_export_stage
|
|
|
|
| 18 |
)
|
|
|
|
| 19 |
|
| 20 |
# Check and display API key status
|
| 21 |
api_key = os.getenv("ANTHROPIC_API_KEY")
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Add custom CSS
|
| 26 |
st.markdown("""
|
|
@@ -84,6 +89,46 @@ st.markdown("""
|
|
| 84 |
background-color: #45a049;
|
| 85 |
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
| 86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
</style>
|
| 88 |
""", unsafe_allow_html=True)
|
| 89 |
|
|
@@ -104,6 +149,15 @@ if "selected_template" not in st.session_state:
|
|
| 104 |
st.session_state.selected_template = "professional"
|
| 105 |
if "slides_content" not in st.session_state:
|
| 106 |
st.session_state.slides_content = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
# Sidebar
|
| 109 |
with st.sidebar:
|
|
@@ -119,10 +173,36 @@ with st.sidebar:
|
|
| 119 |
""", unsafe_allow_html=True)
|
| 120 |
|
| 121 |
# Display API information
|
|
|
|
| 122 |
if api_key:
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
else:
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
# Display current progress
|
| 128 |
st.write("## Your Journey")
|
|
@@ -145,6 +225,27 @@ with st.sidebar:
|
|
| 145 |
st.markdown(f"### {stage['icon']} {stage['name']}")
|
| 146 |
|
| 147 |
st.write("---")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
st.markdown("""
|
| 149 |
<div style="text-align: center;">
|
| 150 |
<div>Made with π by SlideGator.AI</div>
|
|
|
|
| 9 |
|
| 10 |
import uuid
|
| 11 |
import os
|
| 12 |
+
import json
|
| 13 |
+
from updated_components import (
|
| 14 |
render_ideation_stage,
|
| 15 |
render_storyboard_stage,
|
| 16 |
render_template_stage,
|
| 17 |
render_slides_stage,
|
| 18 |
+
render_export_stage,
|
| 19 |
+
render_ai_settings
|
| 20 |
)
|
| 21 |
+
from multi_llm_provider import get_ai_manager
|
| 22 |
|
| 23 |
# Check and display API key status
|
| 24 |
api_key = os.getenv("ANTHROPIC_API_KEY")
|
| 25 |
+
openai_key = os.getenv("OPENAI_API_KEY")
|
| 26 |
+
deepseek_key = os.getenv("DEEPSEEK_API_KEY")
|
| 27 |
+
perplexity_key = os.getenv("PERPLEXITY_API_KEY")
|
| 28 |
+
pexels_key = os.getenv("PEXELS_API_KEY")
|
| 29 |
|
| 30 |
# Add custom CSS
|
| 31 |
st.markdown("""
|
|
|
|
| 89 |
background-color: #45a049;
|
| 90 |
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
| 91 |
}
|
| 92 |
+
|
| 93 |
+
/* AI settings panel */
|
| 94 |
+
.ai-settings {
|
| 95 |
+
background-color: #f9f9f9;
|
| 96 |
+
border-radius: 8px;
|
| 97 |
+
padding: 12px;
|
| 98 |
+
margin-top: 15px;
|
| 99 |
+
border: 1px solid #eee;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
/* Enhanced image cards */
|
| 103 |
+
.image-card {
|
| 104 |
+
border: 1px solid #ddd;
|
| 105 |
+
border-radius: 8px;
|
| 106 |
+
overflow: hidden;
|
| 107 |
+
transition: transform 0.3s ease;
|
| 108 |
+
}
|
| 109 |
+
.image-card:hover {
|
| 110 |
+
transform: scale(1.03);
|
| 111 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
/* Tabs styling */
|
| 115 |
+
.stTabs [data-baseweb="tab-list"] {
|
| 116 |
+
gap: 8px;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.stTabs [data-baseweb="tab"] {
|
| 120 |
+
height: 50px;
|
| 121 |
+
white-space: pre-wrap;
|
| 122 |
+
background-color: #f0f2f6;
|
| 123 |
+
border-radius: 4px 4px 0 0;
|
| 124 |
+
padding: 8px 16px;
|
| 125 |
+
font-weight: 600;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.stTabs [aria-selected="true"] {
|
| 129 |
+
background-color: #4CAF50 !important;
|
| 130 |
+
color: white !important;
|
| 131 |
+
}
|
| 132 |
</style>
|
| 133 |
""", unsafe_allow_html=True)
|
| 134 |
|
|
|
|
| 149 |
st.session_state.selected_template = "professional"
|
| 150 |
if "slides_content" not in st.session_state:
|
| 151 |
st.session_state.slides_content = []
|
| 152 |
+
if "default_model" not in st.session_state:
|
| 153 |
+
st.session_state.default_model = "claude-3-sonnet-20250219"
|
| 154 |
+
if "ai_temperature" not in st.session_state:
|
| 155 |
+
st.session_state.ai_temperature = 0.7
|
| 156 |
+
if "enable_web_search" not in st.session_state:
|
| 157 |
+
st.session_state.enable_web_search = False
|
| 158 |
+
|
| 159 |
+
# Initialize AI provider manager
|
| 160 |
+
ai_manager = get_ai_manager()
|
| 161 |
|
| 162 |
# Sidebar
|
| 163 |
with st.sidebar:
|
|
|
|
| 173 |
""", unsafe_allow_html=True)
|
| 174 |
|
| 175 |
# Display API information
|
| 176 |
+
api_status = []
|
| 177 |
if api_key:
|
| 178 |
+
api_status.append("π’ Claude AI")
|
| 179 |
+
else:
|
| 180 |
+
api_status.append("π΄ Claude AI (not connected)")
|
| 181 |
+
|
| 182 |
+
if openai_key:
|
| 183 |
+
api_status.append("π’ OpenAI")
|
| 184 |
+
else:
|
| 185 |
+
api_status.append("βͺ OpenAI (optional)")
|
| 186 |
+
|
| 187 |
+
if deepseek_key:
|
| 188 |
+
api_status.append("π’ DeepSeek")
|
| 189 |
+
else:
|
| 190 |
+
api_status.append("βͺ DeepSeek (optional)")
|
| 191 |
+
|
| 192 |
+
if perplexity_key:
|
| 193 |
+
api_status.append("π’ Perplexity")
|
| 194 |
else:
|
| 195 |
+
api_status.append("βͺ Web Search (optional)")
|
| 196 |
+
|
| 197 |
+
if pexels_key:
|
| 198 |
+
api_status.append("π’ Stock Images")
|
| 199 |
+
else:
|
| 200 |
+
api_status.append("βͺ Stock Images (optional)")
|
| 201 |
+
|
| 202 |
+
st.info("\n".join(api_status))
|
| 203 |
+
|
| 204 |
+
if not api_key:
|
| 205 |
+
st.error("β οΈ ANTHROPIC_API_KEY environment variable not found. The app will use fallback content generation.")
|
| 206 |
|
| 207 |
# Display current progress
|
| 208 |
st.write("## Your Journey")
|
|
|
|
| 225 |
st.markdown(f"### {stage['icon']} {stage['name']}")
|
| 226 |
|
| 227 |
st.write("---")
|
| 228 |
+
|
| 229 |
+
# Settings accordion
|
| 230 |
+
with st.expander("βοΈ Settings", expanded=False):
|
| 231 |
+
# Show presentation info
|
| 232 |
+
if st.session_state.presentation_title:
|
| 233 |
+
st.write(f"**Title:** {st.session_state.presentation_title}")
|
| 234 |
+
|
| 235 |
+
if st.session_state.selected_template:
|
| 236 |
+
st.write(f"**Template:** {st.session_state.selected_template.title()}")
|
| 237 |
+
|
| 238 |
+
# Show slide count
|
| 239 |
+
if st.session_state.slides_content:
|
| 240 |
+
st.write(f"**Slides:** {len(st.session_state.slides_content)}")
|
| 241 |
+
elif st.session_state.storyboard:
|
| 242 |
+
st.write(f"**Planned Slides:** {len(st.session_state.storyboard)}")
|
| 243 |
+
|
| 244 |
+
# Debugging options
|
| 245 |
+
show_debug = st.checkbox("Show Debug Info", value=False)
|
| 246 |
+
if show_debug:
|
| 247 |
+
st.code(json.dumps({k: v for k, v in st.session_state.items() if k not in ["custom_template", "ai_manager", "slides_content", "storyboard"]}, default=str, indent=2))
|
| 248 |
+
|
| 249 |
st.markdown("""
|
| 250 |
<div style="text-align: center;">
|
| 251 |
<div>Made with π by SlideGator.AI</div>
|