fffiloni commited on
Commit
199441c
1 Parent(s): 5d6ce2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -38,10 +38,14 @@ def infer(prompt):
38
  """)
39
  is_safe = safety_check(prompt)
40
  print(is_safe)
41
- words = is_safe.split()
42
- # Take the first word and convert it to a string variable
43
- status = str(words[0])
44
- print(f"FIRST WORD:{status}")
 
 
 
 
45
  if status == "Yes" :
46
  raise gr.Error("Don't ask for such things.")
47
  else:
 
38
  """)
39
  is_safe = safety_check(prompt)
40
  print(is_safe)
41
+
42
+ match = re.search(r'\bYes\b', is_safe)
43
+
44
+ if match:
45
+ status = 'Yes'
46
+ else:
47
+ status = None
48
+
49
  if status == "Yes" :
50
  raise gr.Error("Don't ask for such things.")
51
  else: