Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +5 -5
src/streamlit_app.py
CHANGED
|
@@ -276,7 +276,7 @@ with col2:
|
|
| 276 |
with st.spinner("Analyzing sentiment..."):
|
| 277 |
sentiment, confidence, all_scores = predict_sentiment_enhanced(review_text)
|
| 278 |
|
| 279 |
-
# Display
|
| 280 |
color_map = {
|
| 281 |
'Very Good': 'green',
|
| 282 |
'Good': 'blue',
|
|
@@ -300,17 +300,17 @@ with col2:
|
|
| 300 |
st.progress(confidence)
|
| 301 |
st.caption(f"Confidence: {confidence:.2%}")
|
| 302 |
|
| 303 |
-
# Show ALL 5 predictions
|
| 304 |
st.subheader("🎯 All 5 Class Predictions")
|
| 305 |
-
# Ensure we always show all 5 classes in order
|
| 306 |
class_order = ['Very Bad', 'Bad', 'Average', 'Good', 'Very Good']
|
| 307 |
for class_name in class_order:
|
| 308 |
score = all_scores.get(class_name, 0.0)
|
| 309 |
emoji_display = emoji_map.get(class_name, '😐')
|
| 310 |
st.write(f"{emoji_display} {class_name}: {score:.1%}")
|
| 311 |
-
|
|
|
|
|
|
|
|
|
|
| 312 |
st.markdown("---")
|
| 313 |
-
|
| 314 |
with st.spinner("Generating AI response..."):
|
| 315 |
ai_response = generate_llm_response(review_text, sentiment)
|
| 316 |
|
|
|
|
| 276 |
with st.spinner("Analyzing sentiment..."):
|
| 277 |
sentiment, confidence, all_scores = predict_sentiment_enhanced(review_text)
|
| 278 |
|
| 279 |
+
# Display sentiment
|
| 280 |
color_map = {
|
| 281 |
'Very Good': 'green',
|
| 282 |
'Good': 'blue',
|
|
|
|
| 300 |
st.progress(confidence)
|
| 301 |
st.caption(f"Confidence: {confidence:.2%}")
|
| 302 |
|
|
|
|
| 303 |
st.subheader("🎯 All 5 Class Predictions")
|
|
|
|
| 304 |
class_order = ['Very Bad', 'Bad', 'Average', 'Good', 'Very Good']
|
| 305 |
for class_name in class_order:
|
| 306 |
score = all_scores.get(class_name, 0.0)
|
| 307 |
emoji_display = emoji_map.get(class_name, '😐')
|
| 308 |
st.write(f"{emoji_display} {class_name}: {score:.1%}")
|
| 309 |
+
|
| 310 |
+
# NEW: put response in col1 below the button
|
| 311 |
+
if analyze_button and review_text.strip():
|
| 312 |
+
with col1:
|
| 313 |
st.markdown("---")
|
|
|
|
| 314 |
with st.spinner("Generating AI response..."):
|
| 315 |
ai_response = generate_llm_response(review_text, sentiment)
|
| 316 |
|