fffiloni commited on
Commit
1b1621a
1 Parent(s): ef1b399

disable safety checker on non shared ui

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -36,19 +36,19 @@ def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
36
  raise gr.Error(f"You forgot to provide a prompt.")
37
 
38
  try:
 
 
 
39
 
40
- is_safe = safety_check(args[0])
41
- print(is_safe)
42
-
43
- match = re.search(r'\bYes\b', is_safe)
44
-
45
- if match:
46
- status = 'Yes'
47
- else:
48
- status = None
49
-
50
- if status == "Yes" :
51
- raise gr.Error("Do not ask for such things.")
52
  else:
53
 
54
  headers = {'Content-Type': 'application/json'}
 
36
  raise gr.Error(f"You forgot to provide a prompt.")
37
 
38
  try:
39
+ if is_shared_ui:
40
+ is_safe = safety_check(args[0])
41
+ print(is_safe)
42
 
43
+ match = re.search(r'\bYes\b', is_safe)
44
+
45
+ if match:
46
+ status = 'Yes'
47
+ else:
48
+ status = None
49
+
50
+ if status == "Yes" :
51
+ raise gr.Error("Do not ask for such things.")
 
 
 
52
  else:
53
 
54
  headers = {'Content-Type': 'application/json'}