Zekun Wu commited on
Commit
d45bfeb
1 Parent(s): c050d3e
Files changed (1) hide show
  1. pages/1_Injection.py +15 -13
pages/1_Injection.py CHANGED
@@ -60,26 +60,28 @@ else:
60
 
61
  # Ensure experiment settings are only shown if model info is submitted
62
  if st.session_state.model_submitted:
63
- df = None
64
  file_options = st.radio("Choose file source:", ["Upload", "Example"])
65
  if file_options == "Example":
66
  #df = pd.read_csv("prompt_test.csv")
67
- df = pd.read_csv("resume.csv")
68
  else:
69
  st.session_state.uploaded_file = st.file_uploader("Choose a file")
70
  if st.session_state.uploaded_file is not None:
71
  data = StringIO(st.session_state.uploaded_file.getvalue().decode("utf-8"))
72
- df = pd.read_csv(data)
73
- if df is not None:
74
- categories = [
75
- "HR", "DESIGNER", "INFORMATION-TECHNOLOGY", "TEACHER", "ADVOCATE", "BUSINESS-DEVELOPMENT",
76
- "HEALTHCARE", "FITNESS", "AGRICULTURE", "BPO", "SALES", "CONSULTANT", "DIGITAL-MEDIA",
77
- "AUTOMOBILE", "CHEF", "FINANCE", "APPAREL", "ENGINEERING", "ACCOUNTANT", "CONSTRUCTION",
78
- "PUBLIC-RELATIONS", "BANKING", "ARTS", "AVIATION"
79
- ]
80
- st.session_state.occupation = st.selectbox("Occupation", options=categories, index=categories.index(
81
- st.session_state.occupation) if st.session_state.occupation in categories else 0)
82
- df = df[df['Occupation'] == st.session_state.occupation]
 
 
83
  st.write('Data:', df)
84
 
85
  # Button to add a new row
 
60
 
61
  # Ensure experiment settings are only shown if model info is submitted
62
  if st.session_state.model_submitted:
63
+ df_raw = None
64
  file_options = st.radio("Choose file source:", ["Upload", "Example"])
65
  if file_options == "Example":
66
  #df = pd.read_csv("prompt_test.csv")
67
+ df_raw = pd.read_csv("resume.csv")
68
  else:
69
  st.session_state.uploaded_file = st.file_uploader("Choose a file")
70
  if st.session_state.uploaded_file is not None:
71
  data = StringIO(st.session_state.uploaded_file.getvalue().decode("utf-8"))
72
+ df_raw = pd.read_csv(data)
73
+ if df_raw is not None:
74
+ if file_options == "Example":
75
+ categories = ["HR", "DESIGNER", "INFORMATION-TECHNOLOGY", "TEACHER", "ADVOCATE", "BUSINESS-DEVELOPMENT",
76
+ "HEALTHCARE", "FITNESS", "AGRICULTURE", "BPO", "SALES", "CONSULTANT", "DIGITAL-MEDIA",
77
+ "AUTOMOBILE", "CHEF", "FINANCE", "APPAREL", "ENGINEERING", "ACCOUNTANT", "CONSTRUCTION",
78
+ "PUBLIC-RELATIONS", "BANKING", "ARTS", "AVIATION"]
79
+
80
+ st.session_state.occupation = st.selectbox("Occupation", options=categories, index=categories.index(st.session_state.occupation) if st.session_state.occupation in categories else 0)
81
+ df = df_raw[df_raw['Occupation'] == st.session_state.occupation]
82
+ else:
83
+ df = df_raw
84
+
85
  st.write('Data:', df)
86
 
87
  # Button to add a new row