Harshb11 commited on
Commit
0df9b50
Β·
verified Β·
1 Parent(s): 5937b4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -26
app.py CHANGED
@@ -1,20 +1,13 @@
1
  import streamlit as st
2
- import matplotlib.pyplot as plt
3
- from mca_comment_analyzer import MCACommentAnalyzer
4
 
5
- # Streamlit Page Config
6
- st.set_page_config(
7
- page_title="MCA Comment Analyzer",
8
- page_icon="πŸ“Š",
9
- layout="wide"
10
- )
11
-
12
- st.title("πŸ“Š MCA eConsultation Comment Analyzer")
13
 
14
  # Sidebar
15
  st.sidebar.header("Upload or Enter Comments")
16
- upload_file = st.sidebar.file_uploader("Upload a text file with comments", type=["txt"])
17
- manual_input = st.sidebar.text_area("Or enter comments (one per line):")
18
 
19
  comments = []
20
  if upload_file:
@@ -22,28 +15,19 @@ if upload_file:
22
  elif manual_input.strip():
23
  comments = manual_input.strip().split("\n")
24
 
25
- if st.sidebar.button("πŸš€ Analyze"):
26
  if comments:
27
- analyzer = MCACommentAnalyzer()
28
  df, keyword_freq = analyzer.process_comments(comments)
29
 
30
- # Show Analysis Results
31
  st.subheader("πŸ“Œ Analysis Results")
32
  st.dataframe(df, use_container_width=True)
33
 
34
- # Sentiment Distribution Chart
35
  st.subheader("πŸ“Š Sentiment Distribution")
36
- sentiment_counts = df["Sentiment"].value_counts()
37
- st.bar_chart(sentiment_counts)
38
 
39
- # Word Cloud
40
  st.subheader("☁️ Word Cloud")
41
- fig = analyzer.generate_wordcloud(keyword_freq)
42
- st.pyplot(fig)
43
-
44
- # Keyword Frequency Table
45
- st.subheader("πŸ”‘ Keyword Frequency")
46
- st.dataframe(keyword_freq, use_container_width=True)
47
-
48
  else:
49
  st.warning("⚠️ Please provide comments to analyze.")
 
1
  import streamlit as st
2
+ from mca_comment_analyzer_light import MCACommentAnalyzerLight
 
3
 
4
+ st.set_page_config(page_title="MCA Comment Analyzer Light", layout="wide")
5
+ st.title("πŸ“Š MCA eConsultation Comment Analyzer (Light)")
 
 
 
 
 
 
6
 
7
  # Sidebar
8
  st.sidebar.header("Upload or Enter Comments")
9
+ upload_file = st.sidebar.file_uploader("Upload a text file (.txt)", type=["txt"])
10
+ manual_input = st.sidebar.text_area("Or enter comments (one per line)")
11
 
12
  comments = []
13
  if upload_file:
 
15
  elif manual_input.strip():
16
  comments = manual_input.strip().split("\n")
17
 
18
+ if st.sidebar.button("Analyze"):
19
  if comments:
20
+ analyzer = MCACommentAnalyzerLight()
21
  df, keyword_freq = analyzer.process_comments(comments)
22
 
 
23
  st.subheader("πŸ“Œ Analysis Results")
24
  st.dataframe(df, use_container_width=True)
25
 
 
26
  st.subheader("πŸ“Š Sentiment Distribution")
27
+ st.bar_chart(df["Sentiment"].value_counts())
 
28
 
 
29
  st.subheader("☁️ Word Cloud")
30
+ plt = analyzer.generate_wordcloud(keyword_freq)
31
+ st.pyplot(plt)
 
 
 
 
 
32
  else:
33
  st.warning("⚠️ Please provide comments to analyze.")