Spaces:
Runtime error
Runtime error
rodolfoocampo
commited on
Commit
•
e6630ec
1
Parent(s):
ea6c55f
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import os
|
|
3 |
import gradio as gr
|
4 |
import openai
|
5 |
|
6 |
-
|
7 |
|
8 |
def generateStory(theme1, theme2, teaching, read_time):
|
9 |
if read_time > 0:
|
@@ -22,7 +22,7 @@ def generateStory(theme1, theme2, teaching, read_time):
|
|
22 |
prompt_text += f" The story should be approximately {word_counts} words long, corresponding to approximately a {read_time} minute read."
|
23 |
prompt_text += "The story should have a tone similar to this: 'Once there was an evil wizard who made a mirror with his dark magic. If anything good or beautiful was put in front of the mirror, the reflection that showed back was only rotten and gray. The wizard laughed. He wanted to show his evil mirror to the whole world! He took it and flew up high into the sky.'"
|
24 |
|
25 |
-
|
26 |
response = openai.Completion.create(
|
27 |
engine="text-davinci-003",
|
28 |
prompt=prompt_text,
|
|
|
3 |
import gradio as gr
|
4 |
import openai
|
5 |
|
6 |
+
|
7 |
|
8 |
def generateStory(theme1, theme2, teaching, read_time):
|
9 |
if read_time > 0:
|
|
|
22 |
prompt_text += f" The story should be approximately {word_counts} words long, corresponding to approximately a {read_time} minute read."
|
23 |
prompt_text += "The story should have a tone similar to this: 'Once there was an evil wizard who made a mirror with his dark magic. If anything good or beautiful was put in front of the mirror, the reflection that showed back was only rotten and gray. The wizard laughed. He wanted to show his evil mirror to the whole world! He took it and flew up high into the sky.'"
|
24 |
|
25 |
+
openai.api_key = os.environ['OPENAI_KEY']
|
26 |
response = openai.Completion.create(
|
27 |
engine="text-davinci-003",
|
28 |
prompt=prompt_text,
|