Spaces:
Build error
Build error
Commit ·
a285530
1
Parent(s): 2ebd7b4
Update functional.py
Browse files- functional.py +21 -1
functional.py
CHANGED
|
@@ -53,4 +53,24 @@ not a Chinese-Chinese translator or an English-English translator. Below is the
|
|
| 53 |
"Color": "secondary",
|
| 54 |
},
|
| 55 |
}
|
| 56 |
-
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
"Color": "secondary",
|
| 54 |
},
|
| 55 |
}
|
| 56 |
+
'''
|
| 57 |
+
|
| 58 |
+
import openai
|
| 59 |
+
import os
|
| 60 |
+
|
| 61 |
+
openai.api_key = os.environ["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"]
|
| 62 |
+
model_engine = "text-davinci-002"
|
| 63 |
+
prompt = "Hello, ChatGPT!"
|
| 64 |
+
|
| 65 |
+
completions = openai.Completion.create(
|
| 66 |
+
engine=model_engine,
|
| 67 |
+
prompt=prompt,
|
| 68 |
+
max_tokens=1024,
|
| 69 |
+
n=1,
|
| 70 |
+
stop=None,
|
| 71 |
+
temperature=0.5,
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
message = completions.choices[0].text
|
| 75 |
+
print(message)
|
| 76 |
+
|