Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| def apply_custom_styles(): | |
| st.markdown(""" | |
| <style> | |
| .stApp { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%); | |
| background-attachment: fixed; | |
| min-height: 100vh; | |
| } | |
| .upload-container { | |
| border: 2px dashed #0066cc; | |
| border-radius: 10px; | |
| padding: 20px; | |
| text-align: center; | |
| margin: 20px 0; | |
| background: rgba(255, 255, 255, 0.9); | |
| backdrop-filter: blur(5px); | |
| } | |
| .factor-card { | |
| background-color: rgba(255, 255, 255, 0.95); | |
| padding: 20px; | |
| border-radius: 10px; | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| margin: 10px 0; | |
| backdrop-filter: blur(5px); | |
| height: 100%; | |
| } | |
| .good-factor { | |
| border-left: 4px solid #28a745; | |
| } | |
| .average-factor { | |
| border-left: 4px solid #ffc107; | |
| } | |
| .bad-factor { | |
| border-left: 4px solid #dc3545; | |
| } | |
| .header-container { | |
| padding: 2rem 0; | |
| margin-bottom: 2rem; | |
| background: linear-gradient(90deg, #0066cc 0%, #0099ff 100%); | |
| color: white; | |
| border-radius: 10px; | |
| text-align: center; | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| } | |
| .detailed-factor { | |
| padding: 15px; | |
| border-radius: 8px; | |
| margin: 10px 0; | |
| background: rgba(255, 255, 255, 0.9); | |
| border-left: 4px solid #666; | |
| } | |
| .detailed-factor.good { | |
| border-left-color: #28a745; | |
| background: rgba(40, 167, 69, 0.1); | |
| } | |
| .detailed-factor.average { | |
| border-left-color: #ffc107; | |
| background: rgba(255, 193, 7, 0.1); | |
| } | |
| .detailed-factor.bad { | |
| border-left-color: #dc3545; | |
| background: rgba(220, 53, 69, 0.1); | |
| } | |
| .comparison-table { | |
| background: white; | |
| border-radius: 10px; | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| margin: 20px 0; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| def show_factor_section(title, factors, color): | |
| if factors: | |
| st.markdown(f""" | |
| <div class="factor-card {color}-factor"> | |
| <h3 style="color: #333;">{title}</h3> | |
| <ul style="list-style-type: none; padding-left: 0;"> | |
| {"".join(f'<li style="margin: 10px 0; padding: 10px; background: rgba(248, 249, 250, 0.8); border-radius: 5px;">{factor}</li>' for factor in factors)} | |
| </ul> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| def show_detailed_factors(good_factors, average_factors, bad_factors): | |
| for factor in good_factors: | |
| name, explanation = factor.split(':', 1) | |
| st.markdown(f""" | |
| <div class="detailed-factor good"> | |
| <strong>{name}</strong> | |
| <p style="margin: 5px 0 0 0; color: #666;">{explanation}</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| for factor in average_factors: | |
| name, explanation = factor.split(':', 1) | |
| st.markdown(f""" | |
| <div class="detailed-factor average"> | |
| <strong>{name}</strong> | |
| <p style="margin: 5px 0 0 0; color: #666;">{explanation}</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| for factor in bad_factors: | |
| name, explanation = factor.split(':', 1) | |
| st.markdown(f""" | |
| <div class="detailed-factor bad"> | |
| <strong>{name}</strong> | |
| <p style="margin: 5px 0 0 0; color: #666;">{explanation}</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| def show_factor_summary(summary, verdict, sentiment_title): | |
| if len(summary) > 0: | |
| st.markdown(f""" | |
| <div class="detailed-factor {verdict}"> | |
| <strong>{sentiment_title}</strong> | |
| <p style="margin: 5px 0 0 0; color: #666;">{summary}</p> | |
| </div> | |
| """, unsafe_allow_html=True) |