AYYasaswini commited on
Commit
cc6aa09
·
verified ·
1 Parent(s): 34bc8eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -263,13 +263,13 @@ def generate_loss_based_image(text_embeddings, seed, max_length):
263
 
264
 
265
  def generate_image_from_prompt(text_in, style_in):
266
- STYLE_LIST = ['learned_embeds_gartic-phone.bin','learned_embeds_hawaiian-shirt.bin', 'learned_embeds_phone0.bin1','learned_embeds_style-spdmn.bin','learned_embedssd_yvmqznrm.bin']
267
  STYLE_SEEDS = [128, 64, 128, 64, 128]
268
 
269
  print(text_in)
270
  print(style_in)
271
- style_file = style_in + '.bin'
272
- idx = STYLE_LIST.index('learned_embeds_gartic-phone.bin')
273
  print(style_file)
274
  print(idx)
275
 
@@ -290,26 +290,28 @@ def generate_image_from_prompt(text_in, style_in):
290
  title = 'Stable Diffusion Art Generator'
291
 
292
  # Add clear and concise labels and instructions
293
- prompt_label = "A campfire (oil on canvas)"
294
  styles_label = "Select a Pretrained Style:"
295
 
296
  instructions = "Explore creative art generation using Stable Diffusion. Enter a prompt and choose a style to get started."
297
 
298
  demo = gr.Interface(generate_image_from_prompt,
299
- inputs = [gr.Textbox(label='Prompt'),
300
- gr.Dropdown(['learned_embeds_gartic-phone','learned_embeds_hawaiian-shirt', 'learned_embeds_phone0','learned_embeds_style-spdmn','learned_embedssd_yvmqznrm'],
301
- value="learned_embeds_gartic-phone",
302
- label=styles_label
 
 
 
303
  ),
304
  ],
305
  outputs=[
306
  gr.Gallery(label="Generated Images", show_label=False, elem_id="gallery", columns=[2], rows=[2],
307
- object_fit="contain"),
308
  ],
309
  title=title,
310
  description=instructions,
311
  theme="compact" # Apply a predefined theme
312
  )
313
-
314
 
315
  demo.launch(debug=True)
 
263
 
264
 
265
  def generate_image_from_prompt(text_in, style_in):
266
+ STYLE_LIST = ['oil_style.bin', 'valorant_style.bin', 'cartoon_syle.bin', 'space_style.bin', 'terraria_syle.bin']
267
  STYLE_SEEDS = [128, 64, 128, 64, 128]
268
 
269
  print(text_in)
270
  print(style_in)
271
+ style_file = style_in + '_style.bin'
272
+ idx = STYLE_LIST.index(style_file)
273
  print(style_file)
274
  print(idx)
275
 
 
290
  title = 'Stable Diffusion Art Generator'
291
 
292
  # Add clear and concise labels and instructions
293
+ prompt_label = "Enter a prompt (e.g., 'man in style of puppy'):"
294
  styles_label = "Select a Pretrained Style:"
295
 
296
  instructions = "Explore creative art generation using Stable Diffusion. Enter a prompt and choose a style to get started."
297
 
298
  demo = gr.Interface(generate_image_from_prompt,
299
+ inputs=[
300
+ gr.Textbox('man in style of puppy', label=prompt_label, style="width: 100%"),
301
+ gr.Dropdown(
302
+ ['oil', 'valorant', 'cartoon', 'space', 'terraria'],
303
+ value="valorant",
304
+ label=styles_label,
305
+ style="width: 100%"
306
  ),
307
  ],
308
  outputs=[
309
  gr.Gallery(label="Generated Images", show_label=False, elem_id="gallery", columns=[2], rows=[2],
310
+ object_fit="contain", style="max-width: 800px; margin: 20px auto;"),
311
  ],
312
  title=title,
313
  description=instructions,
314
  theme="compact" # Apply a predefined theme
315
  )
 
316
 
317
  demo.launch(debug=True)