hra commited on
Commit
9b63e90
1 Parent(s): 39e49d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -49,13 +49,13 @@ prompt_image=str(r.content, 'UTF-8')
49
  print(prompt_image)
50
 
51
  ENDPOINT_URL="https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2-1" # url of your endpoint
52
- #ENDPOINT_URL="https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-1-5" # url of your endpoint
53
- HF_TOKEN=API_TOKEN# token where you deployed your endpoint
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)
58
- payload = {"inputs": prompt_SD,"seed":random.randint(0,100),"negative_prompt":neg_prompt,"parameters": {
59
  "width": 768,
60
  "height": 768,
61
 
@@ -179,20 +179,20 @@ def getadvertisement(topic):
179
  with gr.Blocks() as demo:
180
  gr.Markdown("<h1><center>T-Shirt Designs</center></h1>")
181
  gr.Markdown(
182
- """Enter a prompt and get the t-shirt design. Use examples as a guide. We use an equally powerful AI model bigscience/bloom."""
183
  )
184
  with gr.Row() as row:
185
  with gr.Column():
186
- textbox = gr.Textbox(placeholder="Enter prompt (keep it crisp)...", lines=1,label='Your prompt (Optional)')
187
  btn = gr.Button("Generate")
188
  with gr.Column():
189
- output_image1 = gr.components.Image(label="Your tee shirt")
190
  with gr.Column():
191
- output_image2 = gr.components.Image(label="Your tee shirt")
192
 
193
 
194
  btn.click(getadvertisement,inputs=[textbox], outputs=[output_image1,output_image2])
195
- examples = gr.Examples(examples=['anime art of tokyo','intricate skull concept art','heavy metal band album cover','abstract art of plants',],
196
  inputs=[textbox])
197
 
198
 
 
49
  print(prompt_image)
50
 
51
  ENDPOINT_URL="https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2-1" # url of your endpoint
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)
58
+ payload = {"inputs": prompt_SD,"seed":random.randint(0,1000),"negative_prompt":neg_prompt,"parameters": {
59
  "width": 768,
60
  "height": 768,
61
 
 
179
  with gr.Blocks() as demo:
180
  gr.Markdown("<h1><center>T-Shirt Designs</center></h1>")
181
  gr.Markdown(
182
+ """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."""
183
  )
184
  with gr.Row() as row:
185
  with gr.Column():
186
+ textbox = gr.Textbox(placeholder="Enter prompt...", lines=1,label='Your prompt (Optional)')
187
  btn = gr.Button("Generate")
188
  with gr.Column():
189
+ output_image1 = gr.components.Image(label="Your t-shirt")
190
  with gr.Column():
191
+ output_image2 = gr.components.Image(label="Your t-shirt")
192
 
193
 
194
  btn.click(getadvertisement,inputs=[textbox], outputs=[output_image1,output_image2])
195
+ examples = gr.Examples(examples=['anime style art of batman','intricate skull concept art','heavy metal band album cover','abstract art of plants',],
196
  inputs=[textbox])
197
 
198