Zekun Wu commited on
Commit
5657e82
1 Parent(s): dbf3a36
Files changed (2) hide show
  1. pages/2_Evaluation.py +5 -0
  2. util/plot.py +33 -0
pages/2_Evaluation.py CHANGED
@@ -4,6 +4,7 @@ import streamlit as st
4
  import pandas as pd
5
  from io import StringIO
6
  from util.evaluation import statistical_tests,calculate_correlations,calculate_divergences
 
7
 
8
  def check_password():
9
  def password_entered():
@@ -50,6 +51,10 @@ def app():
50
 
51
  st.write('Combined Results:', results_df)
52
 
 
 
 
 
53
  st.download_button(
54
  label="Download Evaluation Results",
55
  data=results_df.to_csv(index=False).encode('utf-8'),
 
4
  import pandas as pd
5
  from io import StringIO
6
  from util.evaluation import statistical_tests,calculate_correlations,calculate_divergences
7
+ from util.plot import create_sector_plot
8
 
9
  def check_password():
10
  def password_entered():
 
51
 
52
  st.write('Combined Results:', results_df)
53
 
54
+ st.subheader("Construction Sector Scores")
55
+ fig_construction = create_sector_plot(df, df['Occupation'][0])
56
+ st.plotly_chart(fig_construction)
57
+
58
  st.download_button(
59
  label="Download Evaluation Results",
60
  data=results_df.to_csv(index=False).encode('utf-8'),
util/plot.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import plotly.graph_objs as go
3
+
4
+ def create_sector_plot(df, sector_name):
5
+ fig = go.Figure()
6
+
7
+ fig.add_trace(go.Scatter(
8
+ x=df.index, y=df['Privilege_Avg_Score'],
9
+ mode='lines+markers', name='Privilege (Male Info)',
10
+ text=df['Role'], hoverinfo='text+y'
11
+ ))
12
+
13
+ fig.add_trace(go.Scatter(
14
+ x=df.index, y=df['Protect_Avg_Score'],
15
+ mode='lines+markers', name='Protection (Female Info)',
16
+ text=df['Role'], hoverinfo='text+y'
17
+ ))
18
+
19
+ fig.add_trace(go.Scatter(
20
+ x=df.index, y=df['Neutral_Avg_Score'],
21
+ mode='lines+markers', name='Neutral (No Gender Info)',
22
+ text=df['Role'], hoverinfo='text+y'
23
+ ))
24
+
25
+ fig.update_layout(
26
+ title=f'{sector_name} Sector Scores',
27
+ xaxis_title='Resume Index',
28
+ yaxis_title='Score',
29
+ legend_title='Score Type',
30
+ hovermode='closest'
31
+ )
32
+
33
+ return fig