pknayak commited on
Commit
1e94a51
1 Parent(s): b560c66

Create app.py

Browse files

Adding the app.py from the vscode

Files changed (1) hide show
  1. app.py +39 -0
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+
4
+ complaints_count = st.container() # contains the number of complaints in each bucket
5
+ graphs = st.container() # contains the graphs for the complaints
6
+ dataset = st.container() # shows the recent complaints
7
+
8
+
9
+ # TOTAL COUNT SECTION
10
+ with complaints_count:
11
+ st.header("Complaints counts")
12
+ data = "./data/complaints_v1.csv"
13
+ complaints_df = pd.read_csv(data,sep=",")
14
+ total_counts = len(complaints_df.index)
15
+ service_issues_counts = complaints_df['sub_cat'].value_counts()['service_issues']
16
+ product_issues_counts = complaints_df['sub_cat'].value_counts()['product_issues']
17
+ billing_issues_counts = complaints_df['sub_cat'].value_counts()['billing_issues']
18
+
19
+ col1,col2,col3,col4 = st.columns(4)
20
+ col1.metric(label="Total Complaints", value=total_counts, delta="1.2 %")
21
+ col2.metric(label="Total Billing Issues", value=service_issues_counts, delta="-1 %")
22
+ col3.metric(label="Total Product Issues", value=product_issues_counts, delta="-1.3 %")
23
+ col4.metric(label="Total Service Issues ", value=billing_issues_counts, delta="+1.2 ")
24
+
25
+
26
+ #Graphs SECTION
27
+ with graphs:
28
+ st.header("Gprahs")
29
+
30
+
31
+ # RECENT COMPLAINTS SECTION
32
+ with dataset:
33
+ st.header("Recent Complaints")
34
+ ground_truth_data = pd.read_csv("./data/ground_truth.csv")
35
+ ground_truth_data.rename(columns= {'audio_id':'Audio ID','file_name':'File Name', 'transcription':'Complaints', 'sub_cat':'Complaint Category'}, inplace = True)
36
+ columns = ['Audio ID','File Name', 'Complaints', 'Complaint Category']
37
+ st.dataframe(ground_truth_data[columns].iloc[15:23],
38
+ hide_index=True
39
+ )