Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,12 +86,36 @@ def main():
|
|
| 86 |
if result.get('analysis_type') != 'Individual':
|
| 87 |
st.subheader(f"{result['analysis_type']} Results")
|
| 88 |
st.write(result['analysis'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
# Then show individual analyses
|
| 91 |
individual_analyses = [r for r in results if r.get('analysis_type') == 'Individual']
|
| 92 |
for idx, result in enumerate(individual_analyses):
|
| 93 |
st.subheader(f"Analysis Results - Chart {idx + 1}")
|
| 94 |
st.write(result['analysis'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
# Risk warning
|
| 97 |
st.warning(
|
|
|
|
| 86 |
if result.get('analysis_type') != 'Individual':
|
| 87 |
st.subheader(f"{result['analysis_type']} Results")
|
| 88 |
st.write(result['analysis'])
|
| 89 |
+
# Add follow-up section immediately
|
| 90 |
+
follow_up = show_follow_up_section("comparative_followup")
|
| 91 |
+
if follow_up:
|
| 92 |
+
with st.spinner("Processing follow-up..."):
|
| 93 |
+
response = analysis_service.handle_follow_up_question(
|
| 94 |
+
follow_up,
|
| 95 |
+
result['analysis'],
|
| 96 |
+
st.session_state.current_images
|
| 97 |
+
)
|
| 98 |
+
if response:
|
| 99 |
+
st.session_state.chat_history.append(response)
|
| 100 |
+
st.write(response['analysis'])
|
| 101 |
|
| 102 |
# Then show individual analyses
|
| 103 |
individual_analyses = [r for r in results if r.get('analysis_type') == 'Individual']
|
| 104 |
for idx, result in enumerate(individual_analyses):
|
| 105 |
st.subheader(f"Analysis Results - Chart {idx + 1}")
|
| 106 |
st.write(result['analysis'])
|
| 107 |
+
# Add follow-up section for each individual analysis
|
| 108 |
+
follow_up = show_follow_up_section(f"individual_followup_{idx}")
|
| 109 |
+
if follow_up:
|
| 110 |
+
with st.spinner("Processing follow-up..."):
|
| 111 |
+
response = analysis_service.handle_follow_up_question(
|
| 112 |
+
follow_up,
|
| 113 |
+
result['analysis'],
|
| 114 |
+
st.session_state.current_images[idx] if idx < len(st.session_state.current_images) else None
|
| 115 |
+
)
|
| 116 |
+
if response:
|
| 117 |
+
st.session_state.chat_history.append(response)
|
| 118 |
+
st.write(response['analysis'])
|
| 119 |
|
| 120 |
# Risk warning
|
| 121 |
st.warning(
|