Spaces:
Runtime error
Runtime error
Commit
·
e11a0ab
1
Parent(s):
c5e41d5
Create TextGenerator.py
Browse files- TextGenerator.py +10 -0
TextGenerator.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import openai
|
| 2 |
+
openai.api_key="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"
|
| 3 |
+
def Text_generation(Prompt):
|
| 4 |
+
Response=openai.Completion.create(
|
| 5 |
+
model="text-davinci-003",
|
| 6 |
+
prompt=Prompt,
|
| 7 |
+
max_tokens=3096
|
| 8 |
+
)
|
| 9 |
+
Final_Result=Response.choices[0].text.replace("\n","")
|
| 10 |
+
return Final_Result
|