Spaces:
GavinKing
/
Runtime error

multimodalart HF staff commited on
Commit
619076c
1 Parent(s): 18d8f52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -11,15 +11,13 @@ from io import BytesIO
11
  import user_history
12
  from share_btn import community_icon_html, loading_icon_html, share_js
13
 
14
- # TODO
15
- #word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt", use_auth_token=True)
16
- #word_list = word_list_dataset["train"]['text']
17
- word_list = []
18
 
19
  def infer(prompt, negative="low_quality", scale=7, profile: gr.OAuthProfile | None = None):
20
  for filter in word_list:
21
  if re.search(rf"\b{filter}\b", prompt):
22
- raise gr.Error("Unsafe content found. Please try again with different prompts.")
23
 
24
  images = []
25
  url = os.getenv('JAX_BACKEND_URL')
@@ -165,7 +163,7 @@ css = """
165
  #prompt-text-input, #negative-prompt-text-input{padding: .45rem 0.625rem}
166
  #component-16{border-top-width: 1px!important;margin-top: 1em}
167
  .image_duplication{position: absolute; width: 100px; left: 50px}
168
- .tabitem{border: 0}
169
  """
170
 
171
  block = gr.Blocks()
 
11
  import user_history
12
  from share_btn import community_icon_html, loading_icon_html, share_js
13
 
14
+ word_list_dataset = load_dataset("google/word-list-sd", data_files="list.txt", use_auth_token=True)
15
+ word_list = word_list_dataset["train"]['text']
 
 
16
 
17
  def infer(prompt, negative="low_quality", scale=7, profile: gr.OAuthProfile | None = None):
18
  for filter in word_list:
19
  if re.search(rf"\b{filter}\b", prompt):
20
+ raise gr.Error("Please try again with a different prompt")
21
 
22
  images = []
23
  url = os.getenv('JAX_BACKEND_URL')
 
163
  #prompt-text-input, #negative-prompt-text-input{padding: .45rem 0.625rem}
164
  #component-16{border-top-width: 1px!important;margin-top: 1em}
165
  .image_duplication{position: absolute; width: 100px; left: 50px}
166
+ .tabitem{border: 0 !important}
167
  """
168
 
169
  block = gr.Blocks()