hra commited on
Commit
347a429
1 Parent(s): 22bc19b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -61,7 +61,16 @@ for each in nsfwlist:
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)
67
  payload = {"inputs": prompt_SD,"seed":random.randint(0,1000),"negative_prompt":neg_prompt,"parameters": {
@@ -178,7 +187,7 @@ def getadvertisement(topic):
178
  input_keyword='Abstract art with a splash of colors'
179
  print(input_keyword)
180
  print(datetime.today().strftime("%d-%m-%Y"))
181
- prompt_SD=input_keyword+','+prompt_image
182
  # generate image
183
  image = generate_image(prompt_SD)
184
 
@@ -196,7 +205,7 @@ def getadvertisement(topic):
196
  with gr.Blocks() as demo:
197
  gr.Markdown("<h1><center>T-Shirt Design Generator</center></h1>")
198
  gr.Markdown(
199
- """Enter a prompt and get the t-shirt design. Use examples as a guide. \nImage generation via Stable Diffusion 2. When prompt is not provided we use the powerful AI model bigscience/bloom to generate a prompt.\nNote: If there is an error message just try after 30 secs"""
200
  )
201
  with gr.Row() as row:
202
  with gr.Column():
 
61
  nsfwlowerlist.append(each.lower())
62
  nsfwlowerlist.extend(['bra','gay','lesbian',])
63
 
64
+ data={"prompt_type":'stable_diffusion_negative_prompt',"hra_token":HRA_TOKEN}
65
+ try:
66
+ r = requests.post(url_hraprompts, data=json.dumps(data), headers=headers)
67
+ except requests.exceptions.ReadTimeout as e:
68
+ print(e)
69
+ #print(r.content)
70
+
71
+ neg_prompt=str(r.content, 'UTF-8')
72
+ print(neg_prompt)
73
+
74
  def generate_image(prompt_SD:str):
75
  print(prompt_SD)
76
  payload = {"inputs": prompt_SD,"seed":random.randint(0,1000),"negative_prompt":neg_prompt,"parameters": {
 
187
  input_keyword='Abstract art with a splash of colors'
188
  print(input_keyword)
189
  print(datetime.today().strftime("%d-%m-%Y"))
190
+ prompt_SD=input_keyword+' '+prompt_image
191
  # generate image
192
  image = generate_image(prompt_SD)
193
 
 
205
  with gr.Blocks() as demo:
206
  gr.Markdown("<h1><center>T-Shirt Design Generator</center></h1>")
207
  gr.Markdown(
208
+ """Enter a prompt and get the t-shirt design. Use examples as a guide. \nImage generation via Stable Diffusion 2. When a prompt is not provided the powerful AI model bigscience/bloom is used to generate it.\nNote: If there is an error message just try after 30 secs"""
209
  )
210
  with gr.Row() as row:
211
  with gr.Column():