Spaces:
Sleeping
Sleeping
File size: 1,162 Bytes
7699ca2 0df9b50 7699ca2 0df9b50 7699ca2 50c6bfc 7699ca2 0df9b50 7699ca2 0df9b50 7699ca2 0df9b50 7699ca2 0df9b50 7699ca2 0df9b50 7699ca2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import streamlit as st
from mca_comment_analyzer_light import MCACommentAnalyzerLight
st.set_page_config(page_title="MCA Comment Analyzer Light", layout="wide")
st.title("π MCA eConsultation Comment Analyzer (Light)")
# Sidebar
st.sidebar.header("Upload or Enter Comments")
upload_file = st.sidebar.file_uploader("Upload a text file (.txt)", type=["txt"])
manual_input = st.sidebar.text_area("Or enter comments (one per line)")
comments = []
if upload_file:
comments = upload_file.read().decode("utf-8").splitlines()
elif manual_input.strip():
comments = manual_input.strip().split("\n")
if st.sidebar.button("Analyze"):
if comments:
analyzer = MCACommentAnalyzerLight()
df, keyword_freq = analyzer.process_comments(comments)
st.subheader("π Analysis Results")
st.dataframe(df, use_container_width=True)
st.subheader("π Sentiment Distribution")
st.bar_chart(df["Sentiment"].value_counts())
st.subheader("βοΈ Word Cloud")
plt = analyzer.generate_wordcloud(keyword_freq)
st.pyplot(plt)
else:
st.warning("β οΈ Please provide comments to analyze.")
|