fffiloni commited on
Commit
aa9390a
1 Parent(s): 282f3fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,9 +7,9 @@ import re
7
  from gradio_client import Client
8
 
9
  is_shared_ui = True if "fffiloni/consistent-character" in os.environ['SPACE_ID'] else False
10
- def safety_check(user_prompt):
11
 
12
- client = Client("fffiloni/safety-checker-bot", hf_token=hf_token)
13
  response = client.predict(
14
  source_space="consistent-character space",
15
  user_prompt=user_prompt,
@@ -35,7 +35,7 @@ def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
35
  if is_shared_ui:
36
  hf_token = os.environ.get("HF_TOKEN")
37
 
38
- is_safe = safety_check(args[0])
39
  print(is_safe)
40
 
41
  match = re.search(r'\bYes\b', is_safe)
 
7
  from gradio_client import Client
8
 
9
  is_shared_ui = True if "fffiloni/consistent-character" in os.environ['SPACE_ID'] else False
10
+ def safety_check(user_prompt, token):
11
 
12
+ client = Client("fffiloni/safety-checker-bot", hf_token=token)
13
  response = client.predict(
14
  source_space="consistent-character space",
15
  user_prompt=user_prompt,
 
35
  if is_shared_ui:
36
  hf_token = os.environ.get("HF_TOKEN")
37
 
38
+ is_safe = safety_check(args[0], hf_token)
39
  print(is_safe)
40
 
41
  match = re.search(r'\bYes\b', is_safe)