SeemG commited on
Commit
6c573a1
·
verified ·
1 Parent(s): b244a5e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -40,7 +40,7 @@ def reduce_highlight(images):
40
  amber_error = (red_error + green_error + blue_error) / 3
41
  return amber_error
42
 
43
- def _inference(text, style, use_loss=False):
44
  if use_loss:
45
  image = gen_image_as_per_prompt(text, styles_dict[style], seed_dict[style], reduce_highlight)
46
  else:
@@ -49,22 +49,21 @@ def _inference(text, style, use_loss=False):
49
 
50
 
51
  title = "Stable Diffusion with different styles"
52
- description = "In this demo, the word 'puppy' is replaced by the style that is selected"
53
- examples = [["oil painting of a dragon in puppy style", "mosiac", True],
54
- ["Spiderman in puppy style", "midjourney", True],
55
- ["Batman in puppy style", "matrix", False],
56
- ["Mojo Jojo in puppy style", "No style", False]]
57
 
58
  demo = gr.Interface(
59
- _inference,
60
  inputs=[
61
- gr.Textbox(placeholder="Type a prompt with word 'puppy' in it..", container=False, scale=7),
62
  gr.Radio(styles, label="Select a Style"),
63
  gr.Checkbox(label="Use custom loss")
64
  ],
65
  outputs=[
66
- gr.Image(width=256, height=256, label="output")
67
- # gr.Text(label="output")
68
  ],
69
  title=title,
70
  description=description,
 
40
  amber_error = (red_error + green_error + blue_error) / 3
41
  return amber_error
42
 
43
+ def output(text, style, use_loss=False):
44
  if use_loss:
45
  image = gen_image_as_per_prompt(text, styles_dict[style], seed_dict[style], reduce_highlight)
46
  else:
 
49
 
50
 
51
  title = "Stable Diffusion with different styles"
52
+ description = "Explore the versatility of artistic styles by transforming your prompts. This demo takes the word 'cat' in your input and applies a unique style of your choice, giving you a fresh visual interpretation."
53
+ examples = [["A majestic lion with the playful expression of a puppy", "depthmap", True],
54
+ ["A futuristic robot designed in space suit", "midjourney", True],
55
+ ["A serene forest scene, with animals that resemble puppies", "cosmicgalaxy", False],
56
+ ["A warrior in an ancient battlefield, with a hint of puppy charm", "concept-art", False]]
57
 
58
  demo = gr.Interface(
59
+ output,
60
  inputs=[
61
+ gr.Textbox(placeholder="Explore the versatility of artistic styles by transforming your prompts. This demo takes the word 'cat' in your input and applies a unique style of your choice, giving you a fresh visual interpretation.", container=False, scale=7),
62
  gr.Radio(styles, label="Select a Style"),
63
  gr.Checkbox(label="Use custom loss")
64
  ],
65
  outputs=[
66
+ gr.Image(width=512, height=512, label="output")
 
67
  ],
68
  title=title,
69
  description=description,