Update app.py
Browse filesmaking small changes to the values in the respective containers
app.py
CHANGED
|
@@ -13,7 +13,7 @@ dataset = st.container(border=True) #
|
|
| 13 |
|
| 14 |
# TOTAL COUNT SECTION
|
| 15 |
with complaints_count:
|
| 16 |
-
st.header("Complaints counts")
|
| 17 |
data = "./data/complaints_v1.csv"
|
| 18 |
complaints_df = pd.read_csv(data,sep=",")
|
| 19 |
total_counts = len(complaints_df.index)
|
|
@@ -30,29 +30,31 @@ with complaints_count:
|
|
| 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(
|
| 41 |
-
'Product Issues': np.random.randint(
|
| 42 |
-
'Billing Issues': np.random.randint(
|
| 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 |
-
|
| 55 |
-
|
|
|
|
| 56 |
theta=alt.Theta(field="issue_counts", type="quantitative"),
|
| 57 |
color=alt.Color(field="issue_labels", type="nominal"),
|
| 58 |
)
|
|
@@ -62,7 +64,7 @@ with graphs:
|
|
| 62 |
|
| 63 |
# RECENT COMPLAINTS SECTION
|
| 64 |
with dataset:
|
| 65 |
-
st.header("Recent Complaints")
|
| 66 |
ground_truth_data = pd.read_csv("./data/ground_truth.csv")
|
| 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']
|
|
|
|
| 13 |
|
| 14 |
# TOTAL COUNT SECTION
|
| 15 |
with complaints_count:
|
| 16 |
+
st.header("Complaints counts",divider=True)
|
| 17 |
data = "./data/complaints_v1.csv"
|
| 18 |
complaints_df = pd.read_csv(data,sep=",")
|
| 19 |
total_counts = len(complaints_df.index)
|
|
|
|
| 30 |
|
| 31 |
#Graphs SECTION
|
| 32 |
with graphs:
|
| 33 |
+
st.header("Complaints plots", divider=True)
|
|
|
|
| 34 |
col1, col2 = st.columns(2)
|
| 35 |
with col1:
|
| 36 |
st.subheader('Complaints mon-o-mon', divider=True)
|
| 37 |
data = {
|
| 38 |
+
'mon_indx': [1,2,3,4,5,6],
|
| 39 |
'Month': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
| 40 |
+
'Service Issues': np.random.randint(0, 36, size=6),
|
| 41 |
+
'Product Issues': np.random.randint(0, 22, size=6),
|
| 42 |
+
'Billing Issues': np.random.randint(0, 19, size=6)
|
| 43 |
}
|
| 44 |
# Convert to DataFrame
|
| 45 |
mom_df = pd.DataFrame(data)
|
| 46 |
st.line_chart(mom_df,
|
| 47 |
x='Month',
|
| 48 |
+
y=['Service Issues','Product Issues','Billing Issues'],
|
| 49 |
use_container_width=True)
|
| 50 |
|
| 51 |
with col2:
|
| 52 |
st.subheader('Frequent Issues', divider=True)
|
| 53 |
issue_labels = ['service_issues', 'product_issues', 'billing_issues']
|
| 54 |
issue_counts = [complaints_df['sub_cat'].value_counts().get(label, 0) for label in issue_labels]
|
| 55 |
+
|
| 56 |
+
source = pd.DataFrame({"issue_labels": ['Service Issues', 'Product Issues', 'Billing Issues'], "issue_counts": issue_counts})
|
| 57 |
+
chart = alt.Chart(source).mark_arc(innerRadius=120).encode(
|
| 58 |
theta=alt.Theta(field="issue_counts", type="quantitative"),
|
| 59 |
color=alt.Color(field="issue_labels", type="nominal"),
|
| 60 |
)
|
|
|
|
| 64 |
|
| 65 |
# RECENT COMPLAINTS SECTION
|
| 66 |
with dataset:
|
| 67 |
+
st.header("Recent Complaints",divider=True)
|
| 68 |
ground_truth_data = pd.read_csv("./data/ground_truth.csv")
|
| 69 |
ground_truth_data.rename(columns= {'audio_id':'Audio ID','file_name':'File Name', 'transcription':'Complaints', 'sub_cat':'Complaint Category'}, inplace = True)
|
| 70 |
columns = ['Audio ID','File Name', 'Complaints', 'Complaint Category']
|