hra commited on
Commit
22bc19b
·
1 Parent(s): 7c06c0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -17
app.py CHANGED
@@ -52,6 +52,15 @@ ENDPOINT_URL="https://api-inference.huggingface.co/models/stabilityai/stable-dif
52
 
53
  HF_TOKEN=API_TOKEN
54
 
 
 
 
 
 
 
 
 
 
55
  neg_prompt="Not tee shirt, out of frame, lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, out of frame, extra fingers, mutated hands, poorly drawn face, blurry, bad proportions, extra limbs, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"
56
  def generate_image(prompt_SD:str):
57
  print(prompt_SD)
@@ -126,14 +135,7 @@ def getadline(text_inp):
126
  topic = parts[0].strip()
127
  topic="\n".join(topic.split('\n'))
128
 
129
- response_nsfw = requests.get('https://github.com/coffee-and-fun/google-profanity-words/raw/main/data/list.txt')
130
- data_nsfw = response_nsfw.text
131
- nsfwlist=data_nsfw.split('\n')
132
- nsfwlowerlist=[]
133
- for each in nsfwlist:
134
- if each!='':
135
- nsfwlowerlist.append(each.lower())
136
- nsfwlowerlist.extend(['bra','gay','lesbian',])
137
  print(topic)
138
  mainstring=text_inp
139
  foundnsfw=0
@@ -154,14 +156,6 @@ def getadline(text_inp):
154
 
155
  def getadvertisement(topic):
156
  if topic!='':
157
- response_nsfw = requests.get('https://github.com/coffee-and-fun/google-profanity-words/raw/main/data/list.txt')
158
- data_nsfw = response_nsfw.text
159
- nsfwlist=data_nsfw.split('\n')
160
- nsfwlowerlist=[]
161
- for each in nsfwlist:
162
- if each!='':
163
- nsfwlowerlist.append(each.lower())
164
- nsfwlowerlist.extend(['bra','gay','lesbian',])
165
  mainstring=topic
166
  foundnsfw=0
167
  for each_word in nsfwlowerlist:
@@ -177,7 +171,7 @@ def getadvertisement(topic):
177
  if foundnsfw==1:
178
  topic="Unsafe content found. Please try again with different prompts."
179
  print(topic)
180
- input_keyword=topic
181
  else:
182
  input_keyword=getadline(random.choice('abcdefghijklmnopqrstuvwxyz'))
183
  if 'Unsafe content found' in input_keyword:
 
52
 
53
  HF_TOKEN=API_TOKEN
54
 
55
+ response_nsfw = requests.get('https://github.com/coffee-and-fun/google-profanity-words/raw/main/data/list.txt')
56
+ data_nsfw = response_nsfw.text
57
+ nsfwlist=data_nsfw.split('\n')
58
+ nsfwlowerlist=[]
59
+ for each in nsfwlist:
60
+ if each!='':
61
+ nsfwlowerlist.append(each.lower())
62
+ nsfwlowerlist.extend(['bra','gay','lesbian',])
63
+
64
  neg_prompt="Not tee shirt, out of frame, lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, out of frame, extra fingers, mutated hands, poorly drawn face, blurry, bad proportions, extra limbs, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"
65
  def generate_image(prompt_SD:str):
66
  print(prompt_SD)
 
135
  topic = parts[0].strip()
136
  topic="\n".join(topic.split('\n'))
137
 
138
+
 
 
 
 
 
 
 
139
  print(topic)
140
  mainstring=text_inp
141
  foundnsfw=0
 
156
 
157
  def getadvertisement(topic):
158
  if topic!='':
 
 
 
 
 
 
 
 
159
  mainstring=topic
160
  foundnsfw=0
161
  for each_word in nsfwlowerlist:
 
171
  if foundnsfw==1:
172
  topic="Unsafe content found. Please try again with different prompts."
173
  print(topic)
174
+ input_keyword=topic
175
  else:
176
  input_keyword=getadline(random.choice('abcdefghijklmnopqrstuvwxyz'))
177
  if 'Unsafe content found' in input_keyword: