Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
import openai_secret_manager
|
3 |
|
4 |
# Function to get the secret values
|
5 |
def get_secrets():
|
6 |
-
|
7 |
instructor_prompt = openai_secret_manager.get_secret("INSTRUCTOR_PROMPT")
|
8 |
-
return
|
9 |
|
10 |
# Get the secrets
|
11 |
-
|
12 |
|
13 |
# Set your API key
|
14 |
api_key = secrets["INSTRUCTOR_API_KEY"]
|
@@ -24,7 +25,7 @@ with gr.Blocks() as demo:
|
|
24 |
response = openai.Completion.create(
|
25 |
engine="text-davinci-002",
|
26 |
prompt=chat_input,
|
27 |
-
max_tokens=
|
28 |
).choices[0].text.strip()
|
29 |
|
30 |
chat_history.value.append(
|
|
|
1 |
import gradio as gr
|
2 |
+
import openai
|
3 |
import openai_secret_manager
|
4 |
|
5 |
# Function to get the secret values
|
6 |
def get_secrets():
|
7 |
+
secrets = openai_secret_manager.get_secret("INSTRUCTOR_API_KEY")
|
8 |
instructor_prompt = openai_secret_manager.get_secret("INSTRUCTOR_PROMPT")
|
9 |
+
return secrets, instructor_prompt
|
10 |
|
11 |
# Get the secrets
|
12 |
+
secrets, instructor_prompt = get_secrets()
|
13 |
|
14 |
# Set your API key
|
15 |
api_key = secrets["INSTRUCTOR_API_KEY"]
|
|
|
25 |
response = openai.Completion.create(
|
26 |
engine="text-davinci-002",
|
27 |
prompt=chat_input,
|
28 |
+
max_tokens=1024 # Adjust this for response length
|
29 |
).choices[0].text.strip()
|
30 |
|
31 |
chat_history.value.append(
|