Harshb11 commited on
Commit
50c6bfc
Β·
verified Β·
1 Parent(s): bfeaa92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -1,11 +1,17 @@
1
  import streamlit as st
 
2
  from mca_comment_analyzer import MCACommentAnalyzer
3
 
4
- st.set_page_config(page_title="MCA Comment Analyzer", layout="wide")
 
 
 
 
 
5
 
6
  st.title("πŸ“Š MCA eConsultation Comment Analyzer")
7
 
8
- # Sidebar for batch input
9
  st.sidebar.header("Upload or Enter Comments")
10
  upload_file = st.sidebar.file_uploader("Upload a text file with comments", type=["txt"])
11
  manual_input = st.sidebar.text_area("Or enter comments (one per line):")
@@ -16,20 +22,28 @@ if upload_file:
16
  elif manual_input.strip():
17
  comments = manual_input.strip().split("\n")
18
 
19
- if st.sidebar.button("Analyze"):
20
  if comments:
21
  analyzer = MCACommentAnalyzer()
22
  df, keyword_freq = analyzer.process_comments(comments)
23
 
 
24
  st.subheader("πŸ“Œ Analysis Results")
25
  st.dataframe(df, use_container_width=True)
26
 
 
27
  st.subheader("πŸ“Š Sentiment Distribution")
28
  sentiment_counts = df["Sentiment"].value_counts()
29
  st.bar_chart(sentiment_counts)
30
 
 
31
  st.subheader("☁️ Word Cloud")
32
- plt = analyzer.generate_wordcloud(keyword_freq)
33
- st.pyplot(plt)
 
 
 
 
 
34
  else:
35
  st.warning("⚠️ Please provide comments to analyze.")
 
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):")
 
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.")