Logan Zoellner commited on
Commit
e4d28ce
1 Parent(s): 7a59307

fallback if don't get what expected

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -60,10 +60,10 @@ def continue_story(prompt,story):
60
  if "\n" in output_tmp:
61
  idx = output_tmp.find('\n')
62
  output_tmp = output_tmp[:idx]
63
- #check if response starts with "computer:", if not add it
64
- if ":" not in output_tmp:
65
- output_tmp = "computer:"+output_tmp
66
-
67
  print("which was trimmed to",output_tmp)
68
 
69
  #truncate story to last 6 lines
 
60
  if "\n" in output_tmp:
61
  idx = output_tmp.find('\n')
62
  output_tmp = output_tmp[:idx]
63
+ #check if response starts with "computer:", if not use fallback
64
+ if not output_tmp.startswith("computer:"):
65
+ output_tmp = "computer:"+fallbackResponse()
66
+
67
  print("which was trimmed to",output_tmp)
68
 
69
  #truncate story to last 6 lines