-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
45 lines (37 loc) · 1.33 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import streamlit as st
import pandas as pd
import numpy as np
import json
import random
st.title('LLM Impact on Jobs')
st.write('''
Used llama2-13b-chat to assess the impact of LLMs on jobs. The set of job titles is
ONET's list of occupations, which has 1,016 unique titles.
''')
@st.cache_data
def load_data():
with open('./data/list_onet_titles_llm_risk_all.json', 'r') as f:
data = json.load(f)
data_json = json.loads(data)
return data_json
# Load Data
df_onet_titles = pd.read_excel("./data/db_27_3_excel/Occupation Data.xlsx")
list_onet_titles = list(df_onet_titles['Title'])
data = load_data()
# Initialize or get state
if 'selected_title' not in st.session_state:
st.session_state.selected_title = list_onet_titles[0]
# Create a button for random selection
if st.button('Select Random Job Title'):
st.session_state.selected_title = random.choice(list_onet_titles)
# Create a dropdown select box and bind to session_state
st.session_state.selected_title = st.selectbox(
"Or choose a job title manually",
list_onet_titles,
index=list_onet_titles.index(st.session_state.selected_title)
)
# Get index of selected title
index = list_onet_titles.index(st.session_state.selected_title)
# Display results
st.subheader(f'How will LLMs affect {st.session_state.selected_title}?')
st.write(data[index]['generation'])