rodolfoocampo commited on
Commit
a8ebe2f
1 Parent(s): d5c8a18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -147,6 +147,8 @@ with gr.Blocks(css='''
147
 
148
  def generateStory(character):
149
 
 
 
150
  messageHistory=[
151
  {"role": "system", "content": "You are a helpful assistant for storytelling-driven games that writes in the style of Doctor Seuss and Julia Donaldson."},
152
  {"role": "system", "name":"example_user", "content": "We are going to engage in a collaborative storytelling game. You are going to generate a paragraph but you are going to leave a blank in the last word, that I will have to complete in order to generate the next paragraph. We will do this for every paragraph. Please generate the first paragraph. The story is about a {}. Write in the style of Julia Donaldson and Doctor Seuss. Remember, just write one paragraph! After this one paragraph is generated, I will tell you the word that I want to use to fill the blank, and then you can generate the next. For more context, the game works as follows. 1. You generate one, and only one paragraph, with a blank somewhere in the last line of the paragraph. 2. I tell you how I want to fill the blank. 3. You generate the next paragraph based on my response to continue the story, this next paragraph also has a blank somewhere in the last line of the paragraph. 4. I tell you how to fill the blank. And so on."},
 
147
 
148
  def generateStory(character):
149
 
150
+ openai.api_key = openai.api_key = os.environ['OPENAI_KEY']
151
+
152
  messageHistory=[
153
  {"role": "system", "content": "You are a helpful assistant for storytelling-driven games that writes in the style of Doctor Seuss and Julia Donaldson."},
154
  {"role": "system", "name":"example_user", "content": "We are going to engage in a collaborative storytelling game. You are going to generate a paragraph but you are going to leave a blank in the last word, that I will have to complete in order to generate the next paragraph. We will do this for every paragraph. Please generate the first paragraph. The story is about a {}. Write in the style of Julia Donaldson and Doctor Seuss. Remember, just write one paragraph! After this one paragraph is generated, I will tell you the word that I want to use to fill the blank, and then you can generate the next. For more context, the game works as follows. 1. You generate one, and only one paragraph, with a blank somewhere in the last line of the paragraph. 2. I tell you how I want to fill the blank. 3. You generate the next paragraph based on my response to continue the story, this next paragraph also has a blank somewhere in the last line of the paragraph. 4. I tell you how to fill the blank. And so on."},