Spaces:
Runtime error
Runtime error
Logan Zoellner
commited on
Commit
•
b18e03b
1
Parent(s):
ea73078
using global for story turned out to be a bad idea
Browse files
app.py
CHANGED
@@ -16,15 +16,11 @@ computer: you are an adventurer exploring the darkest dungeon
|
|
16 |
player: enter dungeon
|
17 |
"""
|
18 |
|
19 |
-
story="""Computer: You are standing in the enterance of the dungeon.
|
20 |
-
"""
|
21 |
-
|
22 |
|
23 |
def fallbackResponse():
|
24 |
return "You are attacked by a {monster}!".format(monster=random.choice(monsters))
|
25 |
|
26 |
-
def continue_story(prompt):
|
27 |
-
global story
|
28 |
print("about to die",basePrompt,story,prompt)
|
29 |
print("huh?",story)
|
30 |
p=basePrompt+story+"player:"+str(prompt)
|
@@ -69,8 +65,6 @@ def continue_story(prompt):
|
|
69 |
|
70 |
print("which was trimmed to",output_tmp)
|
71 |
|
72 |
-
|
73 |
-
|
74 |
#truncate story to last 6 lines
|
75 |
story_tmp = story.split("\n")
|
76 |
if len(story_tmp)>6:
|
@@ -102,7 +96,7 @@ with demo:
|
|
102 |
|
103 |
|
104 |
|
105 |
-
b0.click(continue_story,inputs=[input_command],outputs=[output_story])
|
106 |
#examples=examples
|
107 |
|
108 |
demo.launch(enable_queue=True, debug=True)
|
|
|
16 |
player: enter dungeon
|
17 |
"""
|
18 |
|
|
|
|
|
|
|
19 |
|
20 |
def fallbackResponse():
|
21 |
return "You are attacked by a {monster}!".format(monster=random.choice(monsters))
|
22 |
|
23 |
+
def continue_story(prompt,story):
|
|
|
24 |
print("about to die",basePrompt,story,prompt)
|
25 |
print("huh?",story)
|
26 |
p=basePrompt+story+"player:"+str(prompt)
|
|
|
65 |
|
66 |
print("which was trimmed to",output_tmp)
|
67 |
|
|
|
|
|
68 |
#truncate story to last 6 lines
|
69 |
story_tmp = story.split("\n")
|
70 |
if len(story_tmp)>6:
|
|
|
96 |
|
97 |
|
98 |
|
99 |
+
b0.click(continue_story,inputs=[input_command,output_story],outputs=[output_story])
|
100 |
#examples=examples
|
101 |
|
102 |
demo.launch(enable_queue=True, debug=True)
|