officialamit558 commited on
Commit
6f53576
·
verified ·
1 Parent(s): 20cdb1d

Delete apps.py

Browse files
Files changed (1) hide show
  1. apps.py +0 -140
apps.py DELETED
@@ -1,140 +0,0 @@
1
- import streamlit as st
2
- import preprocessor,helper
3
- import matplotlib.pyplot as plt
4
- import seaborn as sns
5
-
6
- st.sidebar.title("Whatsapp Chat Analyzer")
7
-
8
- uploaded_file = st.sidebar.file_uploader("Choose a file")
9
-
10
- if uploaded_file is not None:
11
- bytes_data = uploaded_file.getvalue()
12
- data = bytes_data.decode("utf-8")
13
- df = preprocessor.preprocess(data)
14
-
15
- # fetch unique users
16
- user_list = df['user'].unique().tolist()
17
- user_list.remove('group_notification')
18
- user_list.sort()
19
- user_list.insert(0,"Overall")
20
-
21
- selected_user = st.sidebar.selectbox("Show analysis wrt",user_list)
22
-
23
- if st.sidebar.button("Show Analysis"):
24
-
25
- # Stats Area
26
- num_messages, words, num_media_messages, num_links = helper.fetch_stats(selected_user,df)
27
- st.title("Top Statistics")
28
- col1, col2, col3, col4 = st.columns(4)
29
-
30
- with col1:
31
- st.header("Total Messages")
32
- st.title(num_messages)
33
- with col2:
34
- st.header("Total Words")
35
- st.title(words)
36
- with col3:
37
- st.header("Media Shared")
38
- st.title(num_media_messages)
39
- with col4:
40
- st.header("Links Shared")
41
- st.title(num_links)
42
-
43
- # monthly timeline
44
- st.title("Monthly Timeline")
45
- timeline = helper.monthly_timeline(selected_user,df)
46
- fig,ax = plt.subplots()
47
- ax.plot(timeline['time'], timeline['message'],color='green')
48
- plt.xticks(rotation='vertical')
49
- st.pyplot(fig)
50
-
51
- # daily timeline
52
- st.title("Daily Timeline")
53
- daily_timeline = helper.daily_timeline(selected_user, df)
54
- fig, ax = plt.subplots()
55
- ax.plot(daily_timeline['only_date'], daily_timeline['message'], color='black')
56
- plt.xticks(rotation='vertical')
57
- st.pyplot(fig)
58
-
59
- # activity map
60
- st.title('Activity Map')
61
- col1,col2 = st.columns(2)
62
-
63
- with col1:
64
- st.header("Most busy day")
65
- busy_day = helper.week_activity_map(selected_user,df)
66
- fig,ax = plt.subplots()
67
- ax.bar(busy_day.index,busy_day.values,color='purple')
68
- plt.xticks(rotation='vertical')
69
- st.pyplot(fig)
70
-
71
- with col2:
72
- st.header("Most busy month")
73
- busy_month = helper.month_activity_map(selected_user, df)
74
- fig, ax = plt.subplots()
75
- ax.bar(busy_month.index, busy_month.values,color='orange')
76
- plt.xticks(rotation='vertical')
77
- st.pyplot(fig)
78
-
79
- st.title("Weekly Activity Map")
80
- user_heatmap = helper.activity_heatmap(selected_user,df)
81
- fig,ax = plt.subplots()
82
- ax = sns.heatmap(user_heatmap)
83
- st.pyplot(fig)
84
-
85
- # finding the busiest users in the group(Group level)
86
- if selected_user == 'Overall':
87
- st.title('Most Busy Users')
88
- x,new_df = helper.most_busy_users(df)
89
- fig, ax = plt.subplots()
90
-
91
- col1, col2 = st.columns(2)
92
-
93
- with col1:
94
- ax.bar(x.index, x.values,color='red')
95
- plt.xticks(rotation='vertical')
96
- st.pyplot(fig)
97
- with col2:
98
- st.dataframe(new_df)
99
-
100
- # WordCloud
101
- st.title("Wordcloud")
102
- df_wc = helper.create_wordcloud(selected_user,df)
103
- fig,ax = plt.subplots()
104
- ax.imshow(df_wc)
105
- st.pyplot(fig)
106
-
107
- # most common words
108
- most_common_df = helper.most_common_words(selected_user,df)
109
-
110
- fig,ax = plt.subplots()
111
-
112
- ax.barh(most_common_df[0],most_common_df[1])
113
- plt.xticks(rotation='vertical')
114
-
115
- st.title('Most commmon words')
116
- st.pyplot(fig)
117
-
118
- # emoji analysis
119
- emoji_df = helper.emoji_helper(selected_user,df)
120
- st.title("Emoji Analysis")
121
-
122
- col1,col2 = st.columns(2)
123
-
124
- with col1:
125
- st.dataframe(emoji_df)
126
- with col2:
127
- fig,ax = plt.subplots()
128
- ax.pie(emoji_df[1].head(),labels=emoji_df[0].head(),autopct="%0.2f")
129
- st.pyplot(fig)
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-