Spaces:
Running
Running
Zekun Wu
commited on
Commit
·
c41d697
1
Parent(s):
013b4f2
update
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ class AzureAgent:
|
|
39 |
return content
|
40 |
|
41 |
class GPTAgent:
|
42 |
-
def __init__(self, api_key, azure_endpoint, deployment_name, api_version
|
43 |
self.client = AzureOpenAI(
|
44 |
api_key=api_key,
|
45 |
api_version=api_version,
|
@@ -67,6 +67,12 @@ 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 |
# File upload and data display
|
71 |
uploaded_file = st.file_uploader("Choose a file")
|
72 |
if uploaded_file is not None:
|
@@ -83,7 +89,7 @@ if uploaded_file is not None:
|
|
83 |
agent = GPTAgent(api_key, endpoint_url, deployment_name, api_version)
|
84 |
|
85 |
# Example processing step (adapt as needed)
|
86 |
-
df['Response'] = df['prompt'].apply(lambda x: agent.invoke(x,
|
87 |
|
88 |
st.write('Processed Data:', df.head())
|
89 |
|
|
|
39 |
return content
|
40 |
|
41 |
class GPTAgent:
|
42 |
+
def __init__(self, api_key, azure_endpoint, deployment_name, api_version):
|
43 |
self.client = AzureOpenAI(
|
44 |
api_key=api_key,
|
45 |
api_version=api_version,
|
|
|
67 |
deployment_name = st.text_input("Model Name")
|
68 |
api_version = st.text_input("API Version") # Default API version
|
69 |
|
70 |
+
temperature = st.slider("Temperature", min_value=0.0, max_value=1.0, value=0.5, step=0.01)
|
71 |
+
max_tokens = st.number_input("Max Tokens", min_value=1, max_value=1000, value=150)
|
72 |
+
stop_sequences = st.text_input("Stop Sequences", "")
|
73 |
+
parameters = {"temperature": temperature, "max_tokens": max_tokens, "stop": [stop_sequences] if stop_sequences else []}
|
74 |
+
|
75 |
+
|
76 |
# File upload and data display
|
77 |
uploaded_file = st.file_uploader("Choose a file")
|
78 |
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['prompt'].apply(lambda x: agent.invoke(x, parameters))
|
93 |
|
94 |
st.write('Processed Data:', df.head())
|
95 |
|