Spaces:
Running
Running
bhaskartripathi
commited on
Commit
·
b6e2b19
1
Parent(s):
99776b9
Update app.py
Browse files
app.py
CHANGED
@@ -118,20 +118,20 @@ def load_recommender(path, start_page=1):
|
|
118 |
|
119 |
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
|
134 |
-
def generate_text(openAI_key, prompt, engine="gpt-3.5-turbo"):
|
135 |
openai.api_key = openAI_key
|
136 |
messages = [{'role': 'system', 'content': 'You are a helpful assistant.'},
|
137 |
{'role': 'user', 'content': prompt}]
|
|
|
118 |
|
119 |
|
120 |
|
121 |
+
def generate_text2(openAI_key,prompt, engine="text-davinci-003"):
|
122 |
+
openai.api_key = openAI_key
|
123 |
+
completions = openai.Completion.create(
|
124 |
+
engine=engine,
|
125 |
+
prompt=prompt,
|
126 |
+
max_tokens=512,
|
127 |
+
n=1,
|
128 |
+
stop=None,
|
129 |
+
temperature=0.7,
|
130 |
+
)
|
131 |
+
message = completions.choices[0].text
|
132 |
+
return message
|
133 |
|
134 |
+
def generate_text(openAI_key, prompt, engine="gpt-3.5-turbo-0301"):
|
135 |
openai.api_key = openAI_key
|
136 |
messages = [{'role': 'system', 'content': 'You are a helpful assistant.'},
|
137 |
{'role': 'user', 'content': prompt}]
|