Narration 3
Browse files
app.py
CHANGED
|
@@ -89,7 +89,7 @@ def reset_state():
|
|
| 89 |
"tts": {}
|
| 90 |
}
|
| 91 |
st.success("β
Reset complete!")
|
| 92 |
-
st.
|
| 93 |
|
| 94 |
def send_text_request(model_name, prompt, image):
|
| 95 |
"""Helper to send requests that expect only a text response."""
|
|
@@ -241,7 +241,7 @@ def render_sidebar_navigation():
|
|
| 241 |
label = f"{'β' if is_done else 'Β·'} Step {idx}"
|
| 242 |
if st.sidebar.button(label, key=f"nav_{idx}"):
|
| 243 |
st.session_state.app_state['current_step'] = idx
|
| 244 |
-
st.
|
| 245 |
|
| 246 |
def render_tools_list():
|
| 247 |
if st.session_state.app_state['tools_list']:
|
|
@@ -299,10 +299,10 @@ def render_step(idx, text):
|
|
| 299 |
col1, col2, col3 = st.columns([1, 2, 1])
|
| 300 |
if idx > 1 and col1.button("β¬
οΈ Previous", key=f"prev_{idx}"):
|
| 301 |
st.session_state.app_state['current_step'] -= 1
|
| 302 |
-
st.
|
| 303 |
if idx < total and col3.button("Next β‘οΈ", key=f"next_{idx}"):
|
| 304 |
st.session_state.app_state['current_step'] += 1
|
| 305 |
-
st.
|
| 306 |
|
| 307 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 308 |
# 4. APP LAYOUT
|
|
@@ -331,7 +331,7 @@ if not st.session_state.app_state['prompt_sent']:
|
|
| 331 |
if st.button("π Get AI Guidance", type="primary", use_container_width=True):
|
| 332 |
if uploaded_image:
|
| 333 |
initial_analysis(uploaded_image, context_text)
|
| 334 |
-
st.
|
| 335 |
else:
|
| 336 |
st.warning("β οΈ Please upload an image first!")
|
| 337 |
if st.button("π Start Over", use_container_width=True):
|
|
@@ -350,14 +350,14 @@ else:
|
|
| 350 |
for i, option in enumerate(st.session_state.app_state['upcycling_options']):
|
| 351 |
if st.button(option, key=f"option_{i}"):
|
| 352 |
generate_detailed_guide_with_images(selected_option=option)
|
| 353 |
-
st.
|
| 354 |
elif not st.session_state.app_state['plan_approved']:
|
| 355 |
st.markdown("#### The AI has proposed the following plan:")
|
| 356 |
st.success(st.session_state.app_state['initial_plan'])
|
| 357 |
if st.button("β
Looks good, proceed with this plan", type="primary"):
|
| 358 |
st.session_state.app_state['plan_approved'] = True
|
| 359 |
generate_detailed_guide_with_images()
|
| 360 |
-
st.
|
| 361 |
else:
|
| 362 |
render_tools_list()
|
| 363 |
st.markdown("---")
|
|
@@ -367,7 +367,7 @@ else:
|
|
| 367 |
render_step(step_num, step_text)
|
| 368 |
except IndexError:
|
| 369 |
st.session_state.app_state['current_step'] = 1
|
| 370 |
-
st.
|
| 371 |
|
| 372 |
total_steps = len(st.session_state.app_state['steps'])
|
| 373 |
done_count = sum(1 for d in st.session_state.app_state['done_flags'].values() if d)
|
|
|
|
| 89 |
"tts": {}
|
| 90 |
}
|
| 91 |
st.success("β
Reset complete!")
|
| 92 |
+
st.rerun()
|
| 93 |
|
| 94 |
def send_text_request(model_name, prompt, image):
|
| 95 |
"""Helper to send requests that expect only a text response."""
|
|
|
|
| 241 |
label = f"{'β' if is_done else 'Β·'} Step {idx}"
|
| 242 |
if st.sidebar.button(label, key=f"nav_{idx}"):
|
| 243 |
st.session_state.app_state['current_step'] = idx
|
| 244 |
+
st.rerun()
|
| 245 |
|
| 246 |
def render_tools_list():
|
| 247 |
if st.session_state.app_state['tools_list']:
|
|
|
|
| 299 |
col1, col2, col3 = st.columns([1, 2, 1])
|
| 300 |
if idx > 1 and col1.button("β¬
οΈ Previous", key=f"prev_{idx}"):
|
| 301 |
st.session_state.app_state['current_step'] -= 1
|
| 302 |
+
st.rerun()
|
| 303 |
if idx < total and col3.button("Next β‘οΈ", key=f"next_{idx}"):
|
| 304 |
st.session_state.app_state['current_step'] += 1
|
| 305 |
+
st.rerun()
|
| 306 |
|
| 307 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 308 |
# 4. APP LAYOUT
|
|
|
|
| 331 |
if st.button("π Get AI Guidance", type="primary", use_container_width=True):
|
| 332 |
if uploaded_image:
|
| 333 |
initial_analysis(uploaded_image, context_text)
|
| 334 |
+
st.rerun()
|
| 335 |
else:
|
| 336 |
st.warning("β οΈ Please upload an image first!")
|
| 337 |
if st.button("π Start Over", use_container_width=True):
|
|
|
|
| 350 |
for i, option in enumerate(st.session_state.app_state['upcycling_options']):
|
| 351 |
if st.button(option, key=f"option_{i}"):
|
| 352 |
generate_detailed_guide_with_images(selected_option=option)
|
| 353 |
+
st.rerun()
|
| 354 |
elif not st.session_state.app_state['plan_approved']:
|
| 355 |
st.markdown("#### The AI has proposed the following plan:")
|
| 356 |
st.success(st.session_state.app_state['initial_plan'])
|
| 357 |
if st.button("β
Looks good, proceed with this plan", type="primary"):
|
| 358 |
st.session_state.app_state['plan_approved'] = True
|
| 359 |
generate_detailed_guide_with_images()
|
| 360 |
+
st.rerun()
|
| 361 |
else:
|
| 362 |
render_tools_list()
|
| 363 |
st.markdown("---")
|
|
|
|
| 367 |
render_step(step_num, step_text)
|
| 368 |
except IndexError:
|
| 369 |
st.session_state.app_state['current_step'] = 1
|
| 370 |
+
st.rerun()
|
| 371 |
|
| 372 |
total_steps = len(st.session_state.app_state['steps'])
|
| 373 |
done_count = sum(1 for d in st.session_state.app_state['done_flags'].values() if d)
|