Update app.py
Browse filesUpdated the app file with the required changes.
app.py
CHANGED
@@ -1,9 +1,14 @@
|
|
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() #
|
6 |
-
dataset = st.container() #
|
7 |
|
8 |
|
9 |
# TOTAL COUNT SECTION
|
@@ -25,7 +30,34 @@ with complaints_count:
|
|
25 |
|
26 |
#Graphs SECTION
|
27 |
with graphs:
|
28 |
-
st.header("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
# RECENT COMPLAINTS SECTION
|
@@ -35,5 +67,6 @@ with dataset:
|
|
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 |
)
|
|
|
1 |
import streamlit as st
|
2 |
+
st.set_page_config(page_title="CRIS CMS System",layout="wide")
|
3 |
+
|
4 |
import pandas as pd
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
import altair as alt
|
8 |
|
9 |
+
complaints_count = st.container(border=True) # contains the number of complaints in each bucket
|
10 |
+
graphs = st.container(border=True) #
|
11 |
+
dataset = st.container(border=True) #
|
12 |
|
13 |
|
14 |
# TOTAL COUNT SECTION
|
|
|
30 |
|
31 |
#Graphs SECTION
|
32 |
with graphs:
|
33 |
+
st.header("Complaints plots")
|
34 |
+
|
35 |
+
col1, col2 = st.columns(2)
|
36 |
+
with col1:
|
37 |
+
st.subheader('Complaints mon-o-mon', divider=True)
|
38 |
+
data = {
|
39 |
+
'Month': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
40 |
+
'Service Issues': np.random.randint(30, 71, size=6),
|
41 |
+
'Product Issues': np.random.randint(30, 71, size=6),
|
42 |
+
'Billing Issues': np.random.randint(30, 71, size=6)
|
43 |
+
}
|
44 |
+
# Convert to DataFrame
|
45 |
+
mom_df = pd.DataFrame(data)
|
46 |
+
st.line_chart(mom_df,
|
47 |
+
x='Month',
|
48 |
+
use_container_width=True)
|
49 |
+
|
50 |
+
with col2:
|
51 |
+
st.subheader('Frequent Issues', divider=True)
|
52 |
+
issue_labels = ['service_issues', 'product_issues', 'billing_issues']
|
53 |
+
issue_counts = [complaints_df['sub_cat'].value_counts().get(label, 0) for label in issue_labels]
|
54 |
+
source = pd.DataFrame({"issue_labels": issue_labels, "issue_counts": issue_counts})
|
55 |
+
chart = alt.Chart(source).mark_arc(innerRadius=75).encode(
|
56 |
+
theta=alt.Theta(field="issue_counts", type="quantitative"),
|
57 |
+
color=alt.Color(field="issue_labels", type="nominal"),
|
58 |
+
)
|
59 |
+
st.altair_chart(chart, theme="streamlit", use_container_width=True)
|
60 |
+
|
61 |
|
62 |
|
63 |
# RECENT COMPLAINTS SECTION
|
|
|
67 |
ground_truth_data.rename(columns= {'audio_id':'Audio ID','file_name':'File Name', 'transcription':'Complaints', 'sub_cat':'Complaint Category'}, inplace = True)
|
68 |
columns = ['Audio ID','File Name', 'Complaints', 'Complaint Category']
|
69 |
st.dataframe(ground_truth_data[columns].iloc[15:23],
|
70 |
+
hide_index=True,
|
71 |
+
use_container_width=True
|
72 |
)
|