Spaces:
Runtime error
Runtime error
Update updated_components.py
Browse files- updated_components.py +4 -102
updated_components.py
CHANGED
|
@@ -253,7 +253,7 @@ def render_ideation_stage():
|
|
| 253 |
st.rerun()
|
| 254 |
|
| 255 |
def render_storyboard_stage():
|
| 256 |
-
"""Render the storyboard review stage UI"""
|
| 257 |
display_navigation_bar()
|
| 258 |
st.header("π Step 2: Review and Edit Storyboard")
|
| 259 |
|
|
@@ -263,24 +263,9 @@ def render_storyboard_stage():
|
|
| 263 |
# Display storyboard for review with edit options
|
| 264 |
edited_storyboard = []
|
| 265 |
|
| 266 |
-
#
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
# Get AI models for regeneration
|
| 270 |
-
ai_manager = get_ai_manager()
|
| 271 |
-
available_models = ai_manager.get_available_models()
|
| 272 |
-
|
| 273 |
-
selected_model = st.selectbox(
|
| 274 |
-
"AI Model",
|
| 275 |
-
options=list(available_models.keys()),
|
| 276 |
-
format_func=lambda x: available_models.get(x, x),
|
| 277 |
-
index=0,
|
| 278 |
-
key="storyboard_regen_model"
|
| 279 |
-
)
|
| 280 |
-
|
| 281 |
-
with col2:
|
| 282 |
-
if st.button("π Regenerate All", help="Create a new storyboard with current title/purpose"):
|
| 283 |
-
st.info("Storyboard regeneration feature coming soon")
|
| 284 |
|
| 285 |
# Add slide button with options
|
| 286 |
col1, col2 = st.columns([3, 1])
|
|
@@ -367,89 +352,6 @@ def render_storyboard_stage():
|
|
| 367 |
|
| 368 |
visual_elements = st.text_area(f"Visual Elements (one per line) ###{i}", value=visual_elements_text)
|
| 369 |
|
| 370 |
-
# AI enhancement options - USING COLUMNS INSTEAD OF NESTED EXPANDER
|
| 371 |
-
st.write("##### π§ AI Enhancement")
|
| 372 |
-
ai_cols = st.columns(2)
|
| 373 |
-
|
| 374 |
-
with ai_cols[0]:
|
| 375 |
-
# Get AI manager
|
| 376 |
-
ai_manager = get_ai_manager()
|
| 377 |
-
available_models = ai_manager.get_available_models()
|
| 378 |
-
|
| 379 |
-
enhancement_model = st.selectbox(
|
| 380 |
-
"AI Model",
|
| 381 |
-
options=list(available_models.keys()),
|
| 382 |
-
format_func=lambda x: available_models.get(x, x),
|
| 383 |
-
index=0,
|
| 384 |
-
key=f"enhance_model_{i}"
|
| 385 |
-
)
|
| 386 |
-
|
| 387 |
-
with ai_cols[1]:
|
| 388 |
-
enhancement_type = st.selectbox(
|
| 389 |
-
"Enhancement Type",
|
| 390 |
-
["Content", "Title", "Visual Suggestions", "All"],
|
| 391 |
-
key=f"enhance_type_{i}"
|
| 392 |
-
)
|
| 393 |
-
|
| 394 |
-
if st.button("β¨ Enhance with AI", key=f"enhance_slide_{i}"):
|
| 395 |
-
with st.spinner("π§ Enhancing slide content..."):
|
| 396 |
-
# Update slide with current edits first
|
| 397 |
-
updated_slide = {
|
| 398 |
-
'title': slide_title,
|
| 399 |
-
'purpose': slide_purpose,
|
| 400 |
-
'key_points': key_points.split("\n") if "\n" in key_points else [key_points] if key_points else [],
|
| 401 |
-
'visual_elements': visual_elements.split("\n") if "\n" in visual_elements else [visual_elements] if visual_elements else []
|
| 402 |
-
}
|
| 403 |
-
|
| 404 |
-
try:
|
| 405 |
-
from agents import enhance_slide_component
|
| 406 |
-
|
| 407 |
-
# Apply enhancement based on selected type
|
| 408 |
-
if enhancement_type in ["Content", "All"]:
|
| 409 |
-
updated_slide, result = enhance_slide_component(updated_slide, "content")
|
| 410 |
-
|
| 411 |
-
if enhancement_type in ["Title", "All"]:
|
| 412 |
-
updated_slide, result = enhance_slide_component(updated_slide, "title")
|
| 413 |
-
|
| 414 |
-
if enhancement_type in ["Visual Suggestions", "All"]:
|
| 415 |
-
updated_slide, result = enhance_slide_component(updated_slide, "visuals")
|
| 416 |
-
|
| 417 |
-
# Update the storyboard with enhanced slide
|
| 418 |
-
st.session_state.storyboard[i] = updated_slide
|
| 419 |
-
st.success("Slide enhanced with AI!")
|
| 420 |
-
st.rerun()
|
| 421 |
-
except Exception as e:
|
| 422 |
-
st.error(f"Error enhancing slide: {str(e)}")
|
| 423 |
-
|
| 424 |
-
# Web search enhancement - MOVED OUT OF NESTED EXPANDER
|
| 425 |
-
if perplexity_key:
|
| 426 |
-
st.write("##### π Web Search Enhancement")
|
| 427 |
-
search_query = st.text_input(
|
| 428 |
-
"Search Query",
|
| 429 |
-
value=f"latest information about {slide_title}",
|
| 430 |
-
key=f"search_query_{i}"
|
| 431 |
-
)
|
| 432 |
-
|
| 433 |
-
if st.button("π Search & Enhance", key=f"search_enhance_{i}"):
|
| 434 |
-
# Update slide with current edits first
|
| 435 |
-
updated_slide = {
|
| 436 |
-
'title': slide_title,
|
| 437 |
-
'purpose': slide_purpose,
|
| 438 |
-
'key_points': key_points.split("\n") if "\n" in key_points else [key_points] if key_points else [],
|
| 439 |
-
'visual_elements': visual_elements.split("\n") if "\n" in visual_elements else [visual_elements] if visual_elements else []
|
| 440 |
-
}
|
| 441 |
-
|
| 442 |
-
try:
|
| 443 |
-
# Enhance with web search
|
| 444 |
-
enhanced_slide = ai_manager.enhance_with_web_search(updated_slide, search_query)
|
| 445 |
-
|
| 446 |
-
# Update the storyboard
|
| 447 |
-
st.session_state.storyboard[i] = enhanced_slide
|
| 448 |
-
st.success("Slide enhanced with web search results!")
|
| 449 |
-
st.rerun()
|
| 450 |
-
except Exception as e:
|
| 451 |
-
st.error(f"Error enhancing with web search: {str(e)}")
|
| 452 |
-
|
| 453 |
# Update storyboard with edits
|
| 454 |
edited_slide = {
|
| 455 |
'title': slide_title,
|
|
|
|
| 253 |
st.rerun()
|
| 254 |
|
| 255 |
def render_storyboard_stage():
|
| 256 |
+
"""Render the storyboard review stage UI (simplified version without AI features)"""
|
| 257 |
display_navigation_bar()
|
| 258 |
st.header("π Step 2: Review and Edit Storyboard")
|
| 259 |
|
|
|
|
| 263 |
# Display storyboard for review with edit options
|
| 264 |
edited_storyboard = []
|
| 265 |
|
| 266 |
+
# Simple regenerate button
|
| 267 |
+
if st.button("π Regenerate All", help="Create a new storyboard with current title/purpose"):
|
| 268 |
+
st.info("Storyboard regeneration feature coming soon")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
|
| 270 |
# Add slide button with options
|
| 271 |
col1, col2 = st.columns([3, 1])
|
|
|
|
| 352 |
|
| 353 |
visual_elements = st.text_area(f"Visual Elements (one per line) ###{i}", value=visual_elements_text)
|
| 354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
# Update storyboard with edits
|
| 356 |
edited_slide = {
|
| 357 |
'title': slide_title,
|