Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
+
|
4 |
+
secret_value_0 = os.environ.get("openai")
|
5 |
+
|
6 |
+
openai.api_key = secret_value_0
|
7 |
+
|
8 |
+
model_engine = "text-davinci-002"
|
9 |
+
prompt_template = "Say hello world" #prompt_template
|
10 |
+
|
11 |
+
response = openai.Completion.create(
|
12 |
+
engine=model_engine,
|
13 |
+
prompt=prompt_template,
|
14 |
+
max_tokens=124,
|
15 |
+
temperature=0.8,
|
16 |
+
n=1,
|
17 |
+
stop=None,
|
18 |
+
)
|
19 |
+
|
20 |
+
print(response.choices[0].text)
|