kevin1kevin1k commited on
Commit
2c93286
·
verified ·
1 Parent(s): 1282f37

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +26 -12
app.py CHANGED
@@ -202,8 +202,9 @@ def main():
202
  st.rerun()
203
 
204
  with col_settings3:
205
- # Pause/Resume controls (only when auto mode is enabled and optimization started)
206
- if st.session_state.auto_mode and st.session_state.optimization_started:
 
207
  if st.session_state.auto_paused:
208
  if st.button("▶️ Resume", key="resume_btn"):
209
  st.session_state.auto_paused = False
@@ -221,13 +222,24 @@ def main():
221
  if st.session_state.current_results is not None:
222
  is_completed, prompt, generated_image = st.session_state.current_results
223
 
224
- # Always show the actual current results (most up-to-date)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  with col2:
226
  st.subheader("Current Generated Image")
227
- st.image(generated_image, width='stretch')
228
- # Show current step info
229
- current_model_name = st.session_state.optimizer.get_current_model_name()
230
- current_history = st.session_state.optimizer.history if hasattr(st.session_state.optimizer, 'history') else []
231
 
232
  if current_history:
233
  # Show info about the current state
@@ -237,21 +249,23 @@ def main():
237
  st.caption(f"🎯 {current_model_name}")
238
  else:
239
  st.caption(f"🚀 {current_model_name} - Initializing...")
240
-
241
- # Display current prompt
242
- st.text_area("Current Prompt", prompt, height=100)
243
  else:
244
  # Show loading state
245
  with col2:
246
  st.subheader("Generated Image")
247
  st.info("Initializing optimization...")
248
- st.text_area("Current Prompt", "Generating initial prompt...", height=100)
 
249
  is_completed = False
250
  prompt = ""
251
 
252
  # Multi-model progress info
253
  progress_info = st.session_state.optimizer.get_progress_info()
254
- current_model = progress_info['current_model_name']
 
255
 
256
  # Progress metrics
257
  col1, col2, col3, col4 = st.columns(4)
 
202
  st.rerun()
203
 
204
  with col_settings3:
205
+ # Pause/Resume controls (only when auto mode is enabled, optimization started, and not completed)
206
+ optimization_completed = st.session_state.current_results is not None and st.session_state.current_results[0]
207
+ if st.session_state.auto_mode and st.session_state.optimization_started and not optimization_completed:
208
  if st.session_state.auto_paused:
209
  if st.button("▶️ Resume", key="resume_btn"):
210
  st.session_state.auto_paused = False
 
222
  if st.session_state.current_results is not None:
223
  is_completed, prompt, generated_image = st.session_state.current_results
224
 
225
+ # Get current model info
226
+ current_model_name = st.session_state.optimizer.get_current_model_name()
227
+ current_history = st.session_state.optimizer.history if hasattr(st.session_state.optimizer, 'history') else []
228
+
229
+ # If we have current model history, show its latest result instead of current_results
230
+ if current_history:
231
+ latest_step = current_history[-1]
232
+ display_image = latest_step['image']
233
+ display_prompt = latest_step['prompt']
234
+ else:
235
+ # Fallback to current_results
236
+ display_image = generated_image
237
+ display_prompt = prompt
238
+
239
+ # Always show the actual current model's latest result
240
  with col2:
241
  st.subheader("Current Generated Image")
242
+ st.image(display_image, width='stretch')
 
 
 
243
 
244
  if current_history:
245
  # Show info about the current state
 
249
  st.caption(f"🎯 {current_model_name}")
250
  else:
251
  st.caption(f"🚀 {current_model_name} - Initializing...")
252
+
253
+ # Display current prompt under the image
254
+ st.text_area("Current Prompt", display_prompt, height=100)
255
  else:
256
  # Show loading state
257
  with col2:
258
  st.subheader("Generated Image")
259
  st.info("Initializing optimization...")
260
+ # Display loading prompt under the placeholder
261
+ st.text_area("Current Prompt", "Generating initial prompt...", height=100)
262
  is_completed = False
263
  prompt = ""
264
 
265
  # Multi-model progress info
266
  progress_info = st.session_state.optimizer.get_progress_info()
267
+ # Ensure we get the actual current model name (not cached)
268
+ current_model = st.session_state.optimizer.get_current_model_name()
269
 
270
  # Progress metrics
271
  col1, col2, col3, col4 = st.columns(4)