Update app.py
Browse files
app.py
CHANGED
@@ -98,9 +98,36 @@ with st.sidebar:
|
|
98 |
else: st.sidebar.markdown("## π¬ CineGen AI Ultra+"); logger.warning("assets/logo.png not found.")
|
99 |
st.markdown("### Creative Seed")
|
100 |
sb_user_idea = st.text_area("Core Idea:", "Lone wanderer, mythical oasis...", height=100, key="sb_user_idea_u")
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
sb_guidance_opts = {"Standard": "standard", "Artistic": "more_artistic", "Experimental": "experimental_narrative"}
|
105 |
sb_guidance_key = st.selectbox("AI Director Style:", list(sb_guidance_opts.keys()), key="sb_guidance_u")
|
106 |
sb_actual_guidance = sb_guidance_opts[sb_guidance_key]
|
@@ -185,12 +212,11 @@ if not st.session_state.project_story_treatment_scenes_list: st.info("Use the si
|
|
185 |
else:
|
186 |
for i_main_display, scene_content_item_display in enumerate(st.session_state.project_story_treatment_scenes_list):
|
187 |
scene_num_for_display = scene_content_item_display.get('scene_number', i_main_display + 1)
|
188 |
-
scene_title_for_display_main = scene_content_item_display.get('scene_title', 'Untitled Scene')
|
189 |
-
key_base_main_area_widgets = f"s{scene_num_for_display}_main_widgets_loop_v3_{i_main_display}"
|
190 |
|
191 |
if "director_note" in scene_content_item_display and scene_content_item_display['director_note']: st.info(f"π¬ Director Note S{scene_num_for_display}: {scene_content_item_display['director_note']}")
|
192 |
st.subheader(f"SCENE {scene_num_for_display}: {scene_title_for_display_main.upper()}");
|
193 |
-
|
194 |
treatment_display_col, visual_display_col = st.columns([0.45, 0.55])
|
195 |
|
196 |
with treatment_display_col:
|
@@ -217,16 +243,15 @@ else:
|
|
217 |
px_q_disp_main = scene_content_item_display.get('pexels_search_query_κ°λ
', None)
|
218 |
if px_q_disp_main: st.caption(f"Pexels Fallback: `{px_q_disp_main}`")
|
219 |
|
220 |
-
with visual_display_col:
|
221 |
asset_info_main_disp = st.session_state.project_generated_assets_info_list[i_main_display] if i_main_display < len(st.session_state.project_generated_assets_info_list) else None
|
222 |
if asset_info_main_disp and not asset_info_main_disp.get('error') and asset_info_main_disp.get('path') and os.path.exists(asset_info_main_disp['path']):
|
223 |
path_asset_main = asset_info_main_disp['path']; type_asset_main = asset_info_main_disp.get('type','image')
|
224 |
-
# <<< CORRECTED VARIABLE NAME IN CAPTION F-STRING >>>
|
225 |
if type_asset_main == 'image': st.image(path_asset_main, caption=f"S{scene_num_for_display} ({type_asset_main}): {scene_title_for_display_main}")
|
226 |
elif type_asset_main == 'video':
|
227 |
try:
|
228 |
with open(path_asset_main,'rb') as vid_f_main: vid_b_main = vid_f_main.read()
|
229 |
-
st.video(vid_b_main, format="video/mp4", start_time=0); st.caption(f"S{scene_num_for_display} ({type_asset_main}): {scene_title_for_display_main}")
|
230 |
except Exception as e_vid_disp_main_area: st.error(f"Error displaying video {path_asset_main}: {e_vid_disp_main_area}"); logger.error(f"Display video error: {e_vid_disp_main_area}", exc_info=True)
|
231 |
else: st.warning(f"Unknown asset type '{type_asset_main}' S{scene_num_for_display}.")
|
232 |
else:
|
|
|
98 |
else: st.sidebar.markdown("## π¬ CineGen AI Ultra+"); logger.warning("assets/logo.png not found.")
|
99 |
st.markdown("### Creative Seed")
|
100 |
sb_user_idea = st.text_area("Core Idea:", "Lone wanderer, mythical oasis...", height=100, key="sb_user_idea_u")
|
101 |
+
|
102 |
+
# <<< EXPANDED GENRE AND MOOD LISTS >>>
|
103 |
+
genres_list = [
|
104 |
+
"Sci-Fi (General)", "Cyberpunk", "Space Opera", "Post-Apocalyptic", "Dystopian", "Biopunk", "Steampunk",
|
105 |
+
"Fantasy (General)", "High Fantasy", "Urban Fantasy", "Dark Fantasy", "Mythological", "Sword and Sorcery",
|
106 |
+
"Horror (General)", "Supernatural Horror", "Psychological Horror", "Cosmic Horror", "Slasher", "Found Footage", "Body Horror", "Folk Horror",
|
107 |
+
"Thriller (General)", "Psychological Thriller", "Crime Thriller", "Mystery", "Noir", "Techno-thriller",
|
108 |
+
"Action (General)", "Adventure", "Spy Fiction", "Martial Arts", "Heist", "Disaster",
|
109 |
+
"Drama (General)", "Historical Drama", "Biographical", "Coming-of-Age", "Family Drama", "Legal Drama", "Medical Drama", "Political Drama",
|
110 |
+
"Romance (General)", "Romantic Comedy", "Historical Romance",
|
111 |
+
"Comedy (General)", "Satire", "Dark Comedy", "Slapstick", "Mockumentary", "Parody",
|
112 |
+
"Western (General)", "Revisionist Western", "Spaghetti Western",
|
113 |
+
"Animation (Specify Style)", "Experimental", "Surreal", "Documentary Style", "Musical"
|
114 |
+
]
|
115 |
+
default_genre_index = genres_list.index("Post-Apocalyptic") if "Post-Apocalyptic" in genres_list else 0
|
116 |
+
sb_genre = st.selectbox("Genre:", genres_list, index=default_genre_index, key="sb_genre_u")
|
117 |
+
|
118 |
+
moods_list = [
|
119 |
+
"Hopeful yet Desperate", "Mysterious & Eerie", "Gritty & Tense", "Dark & Brooding", "Bleak & Nihilistic",
|
120 |
+
"Epic & Awe-Inspiring", "Melancholy & Reflective", "Whimsical & Lighthearted", "Playful & Energetic",
|
121 |
+
"Suspenseful & Unsettling", "Romantic & Passionate", "Tragic & Somber", "Heartwarming & Sentimental",
|
122 |
+
"Action-Packed & Exciting", "Comedic & Absurdist", "Satirical & Ironic", "Cynical",
|
123 |
+
"Nostalgic & Bittersweet", "Surreal & Dreamlike", "Inspiring & Uplifting", "Triumphant",
|
124 |
+
"Quiet & Contemplative", "Ominous & Foreboding", "Chaotic & Frenetic", "Peaceful & Serene"
|
125 |
+
]
|
126 |
+
default_mood_index = moods_list.index("Hopeful yet Desperate") if "Hopeful yet Desperate" in moods_list else 0
|
127 |
+
sb_mood = st.selectbox("Mood:", moods_list, index=default_mood_index, key="sb_mood_u")
|
128 |
+
# <<< END EXPANDED LISTS >>>
|
129 |
+
|
130 |
+
sb_num_scenes = st.slider("Key Scenes:", 1, 10, 1, key="sb_num_scenes_u")
|
131 |
sb_guidance_opts = {"Standard": "standard", "Artistic": "more_artistic", "Experimental": "experimental_narrative"}
|
132 |
sb_guidance_key = st.selectbox("AI Director Style:", list(sb_guidance_opts.keys()), key="sb_guidance_u")
|
133 |
sb_actual_guidance = sb_guidance_opts[sb_guidance_key]
|
|
|
212 |
else:
|
213 |
for i_main_display, scene_content_item_display in enumerate(st.session_state.project_story_treatment_scenes_list):
|
214 |
scene_num_for_display = scene_content_item_display.get('scene_number', i_main_display + 1)
|
215 |
+
scene_title_for_display_main = scene_content_item_display.get('scene_title', 'Untitled Scene')
|
216 |
+
key_base_main_area_widgets = f"s{scene_num_for_display}_main_widgets_loop_v3_{i_main_display}"
|
217 |
|
218 |
if "director_note" in scene_content_item_display and scene_content_item_display['director_note']: st.info(f"π¬ Director Note S{scene_num_for_display}: {scene_content_item_display['director_note']}")
|
219 |
st.subheader(f"SCENE {scene_num_for_display}: {scene_title_for_display_main.upper()}");
|
|
|
220 |
treatment_display_col, visual_display_col = st.columns([0.45, 0.55])
|
221 |
|
222 |
with treatment_display_col:
|
|
|
243 |
px_q_disp_main = scene_content_item_display.get('pexels_search_query_κ°λ
', None)
|
244 |
if px_q_disp_main: st.caption(f"Pexels Fallback: `{px_q_disp_main}`")
|
245 |
|
246 |
+
with visual_display_col:
|
247 |
asset_info_main_disp = st.session_state.project_generated_assets_info_list[i_main_display] if i_main_display < len(st.session_state.project_generated_assets_info_list) else None
|
248 |
if asset_info_main_disp and not asset_info_main_disp.get('error') and asset_info_main_disp.get('path') and os.path.exists(asset_info_main_disp['path']):
|
249 |
path_asset_main = asset_info_main_disp['path']; type_asset_main = asset_info_main_disp.get('type','image')
|
|
|
250 |
if type_asset_main == 'image': st.image(path_asset_main, caption=f"S{scene_num_for_display} ({type_asset_main}): {scene_title_for_display_main}")
|
251 |
elif type_asset_main == 'video':
|
252 |
try:
|
253 |
with open(path_asset_main,'rb') as vid_f_main: vid_b_main = vid_f_main.read()
|
254 |
+
st.video(vid_b_main, format="video/mp4", start_time=0); st.caption(f"S{scene_num_for_display} ({type_asset_main}): {scene_title_for_display_main}")
|
255 |
except Exception as e_vid_disp_main_area: st.error(f"Error displaying video {path_asset_main}: {e_vid_disp_main_area}"); logger.error(f"Display video error: {e_vid_disp_main_area}", exc_info=True)
|
256 |
else: st.warning(f"Unknown asset type '{type_asset_main}' S{scene_num_for_display}.")
|
257 |
else:
|