0xcyborg commited on
Commit
8398aa6
1 Parent(s): a8afa93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -1,4 +1,6 @@
1
  import gradio as gr
 
 
2
  import random
3
  import time
4
  import requests
@@ -9,6 +11,10 @@ import traceback
9
  from base64 import b64decode,b64encode
10
  from io import BytesIO
11
 
 
 
 
 
12
 
13
  with gr.Blocks(theme="darkdefault") as demo:
14
 
@@ -21,6 +27,11 @@ with gr.Blocks(theme="darkdefault") as demo:
21
  import uuid
22
  import os
23
  print(_prompt,_token)
 
 
 
 
 
24
  r = requests.post(url='https://xcyborgart-app.herokuapp.com/create',data={"prompt":_prompt,"token":_token})
25
  all_data = r.json()
26
  print(all_data.keys())
 
1
  import gradio as gr
2
+ from datasets import load_dataset
3
+
4
  import random
5
  import time
6
  import requests
 
11
  from base64 import b64decode,b64encode
12
  from io import BytesIO
13
 
14
+ word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt", use_auth_token=True)
15
+ word_list = word_list_dataset["train"]['text']
16
+
17
+
18
 
19
  with gr.Blocks(theme="darkdefault") as demo:
20
 
 
27
  import uuid
28
  import os
29
  print(_prompt,_token)
30
+
31
+ for filter in word_list:
32
+ if re.search(rf"\b{filter}\b", _prompt):
33
+ return '','unsafe','','',''
34
+
35
  r = requests.post(url='https://xcyborgart-app.herokuapp.com/create',data={"prompt":_prompt,"token":_token})
36
  all_data = r.json()
37
  print(all_data.keys())