Spaces:
Runtime error
Runtime error
Danil
commited on
Commit
•
86bb3dc
1
Parent(s):
bb00968
Update app.py
Browse files
app.py
CHANGED
@@ -11,19 +11,26 @@ engine = os.environ["engine"]
|
|
11 |
def happytt(temperature,max_tokens,text,stop):
|
12 |
try:
|
13 |
s = json.loads(stop)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
except json.JSONDecodeError:
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
presence_penalty=0,
|
25 |
-
stop=s
|
26 |
-
)
|
27 |
|
28 |
return response.choices[0].text
|
29 |
|
|
|
11 |
def happytt(temperature,max_tokens,text,stop):
|
12 |
try:
|
13 |
s = json.loads(stop)
|
14 |
+
response = openai.Completion.create(
|
15 |
+
engine=engine,
|
16 |
+
prompt=text,
|
17 |
+
temperature=temperature,
|
18 |
+
max_tokens=max_tokens,
|
19 |
+
top_p=1,
|
20 |
+
frequency_penalty=0,
|
21 |
+
presence_penalty=0,
|
22 |
+
stop=s
|
23 |
+
)
|
24 |
except json.JSONDecodeError:
|
25 |
+
response = openai.Completion.create(
|
26 |
+
engine=engine,
|
27 |
+
prompt=text,
|
28 |
+
temperature=temperature,
|
29 |
+
max_tokens=max_tokens,
|
30 |
+
top_p=1,
|
31 |
+
frequency_penalty=0,
|
32 |
+
presence_penalty=0
|
33 |
+
)
|
|
|
|
|
|
|
34 |
|
35 |
return response.choices[0].text
|
36 |
|