Walmart-the-bag commited on
Commit
fdc196f
·
verified ·
1 Parent(s): 71f13e2

fix profanity later

Browse files
Files changed (1) hide show
  1. app.py +1 -9
app.py CHANGED
@@ -2,21 +2,13 @@ import gradio as gr
2
  import requests
3
  import json
4
  import time
5
- from better_profanity import profanity
6
 
7
  url = "https://nexra.aryahcr.cc/api/image/complements"
8
  headers = {"Content-Type": "application/json"}
9
 
10
- profanity.load_censor_words()
11
  no_nsfw_image_path = "no_nsfw.png"
12
 
13
- def is_nsfw(text):
14
- return profanity.contains_profanity(text)
15
-
16
  def generate_image(prompt, model):
17
- if is_nsfw(prompt):
18
- return no_nsfw_image_path
19
-
20
  data = {"prompt": prompt, "model": model}
21
  response = requests.post(url, headers=headers, data=json.dumps(data))
22
 
@@ -51,4 +43,4 @@ iface = gr.Interface(
51
  description="DALLE-2 Generation from Nextra API, NOTE: DALL-E 3 is not supported yet."
52
  )
53
 
54
- iface.launch(share=True)
 
2
  import requests
3
  import json
4
  import time
 
5
 
6
  url = "https://nexra.aryahcr.cc/api/image/complements"
7
  headers = {"Content-Type": "application/json"}
8
 
 
9
  no_nsfw_image_path = "no_nsfw.png"
10
 
 
 
 
11
  def generate_image(prompt, model):
 
 
 
12
  data = {"prompt": prompt, "model": model}
13
  response = requests.post(url, headers=headers, data=json.dumps(data))
14
 
 
43
  description="DALLE-2 Generation from Nextra API, NOTE: DALL-E 3 is not supported yet."
44
  )
45
 
46
+ iface.launch(share=True)