Spaces:
Runtime error
Runtime error
disable safety checker on non shared ui
Browse files
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 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 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'}
|