Spaces:
Running
Running
Zekun Wu
commited on
Commit
·
35b059b
1
Parent(s):
c41d697
update
Browse files
app.py
CHANGED
@@ -61,17 +61,20 @@ class GPTAgent:
|
|
61 |
# Streamlit app interface
|
62 |
st.title('JobFair: A Benchmark for Fairness in LLM Employment Decision')
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
endpoint_url = st.text_input("Endpoint URL")
|
67 |
-
deployment_name = st.text_input("Model Name")
|
68 |
-
api_version = st.text_input("API Version") # Default API version
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
# File upload and data display
|
77 |
uploaded_file = st.file_uploader("Choose a file")
|
@@ -79,7 +82,6 @@ if uploaded_file is not None:
|
|
79 |
# Read data
|
80 |
data = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
81 |
df = pd.read_csv(data)
|
82 |
-
st.write('Uploaded Data:', df.head())
|
83 |
|
84 |
# Process data button
|
85 |
if st.button('Process Data'):
|
@@ -89,14 +91,7 @@ if uploaded_file is not None:
|
|
89 |
agent = GPTAgent(api_key, endpoint_url, deployment_name, api_version)
|
90 |
|
91 |
# Example processing step (adapt as needed)
|
92 |
-
df['Response'] = df['
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
# Generate download link
|
97 |
-
st.download_button(
|
98 |
-
label="Download processed data",
|
99 |
-
data=df.to_csv().encode('utf-8'),
|
100 |
-
file_name='processed_data.csv',
|
101 |
-
mime='text/csv',
|
102 |
-
)
|
|
|
61 |
# Streamlit app interface
|
62 |
st.title('JobFair: A Benchmark for Fairness in LLM Employment Decision')
|
63 |
|
64 |
+
# Streamlit app interface
|
65 |
+
st.sidebar.title('Model Settings')
|
|
|
|
|
|
|
66 |
|
67 |
+
model_type = st.sidebar.radio("Select the type of agent", ('AzureAgent', 'GPTAgent'))
|
68 |
+
api_key = st.sidebar.text_input("API Key", type="password")
|
69 |
+
endpoint_url = st.sidebar.text_input("Endpoint URL")
|
70 |
+
deployment_name = st.sidebar.text_input("Model Name")
|
71 |
+
api_version = st.sidebar.text_input("API Version", '2022-11-01') # Default API version
|
72 |
|
73 |
+
# Model invocation parameters
|
74 |
+
temperature = st.sidebar.slider("Temperature", min_value=0.0, max_value=1.0, value=0.5, step=0.01)
|
75 |
+
max_tokens = st.sidebar.number_input("Max Tokens", min_value=1, max_value=1000, value=150)
|
76 |
+
stop_sequences = st.sidebar.text_input("Stop Sequences", "")
|
77 |
+
parameters = {"temperature": temperature, "max_tokens": max_tokens, "stop": [stop_sequences] if stop_sequences else []}
|
78 |
|
79 |
# File upload and data display
|
80 |
uploaded_file = st.file_uploader("Choose a file")
|
|
|
82 |
# Read data
|
83 |
data = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
84 |
df = pd.read_csv(data)
|
|
|
85 |
|
86 |
# Process data button
|
87 |
if st.button('Process Data'):
|
|
|
91 |
agent = GPTAgent(api_key, endpoint_url, deployment_name, api_version)
|
92 |
|
93 |
# Example processing step (adapt as needed)
|
94 |
+
df['Response'] = df['Input Column'].apply(lambda x: agent.invoke(x, parameters))
|
95 |
|
96 |
+
# Display processed data
|
97 |
+
st.write('Processed Data:', df)
|
|
|
|
|
|
|
|
|
|
|
|
|
|