anzorq commited on
Commit
4cb8223
1 Parent(s): 40a8b65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -8,11 +8,10 @@ pipe = StableDiffusionPipeline.from_pretrained("nitrosocke/Arcane-Diffusion", to
8
  if torch.cuda.is_available():
9
  pipe = pipe.to("cuda")
10
 
11
- def inference(prompt, guidance, steps):
12
- all_images = []
13
- images = pipe([prompt] * 1, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images
14
- all_images.extend(images)
15
- return all_images
16
 
17
  with gr.Blocks() as demo:
18
  gr.HTML(
@@ -39,22 +38,22 @@ with gr.Blocks() as demo:
39
  with gr.Row():
40
 
41
  with gr.Column():
42
- prompt = gr.Textbox(label="prompt", placeholder="(append ' , arcane style' as shown in the examples)")
43
  guidance = gr.Slider(label="guidance scale", value=7.5, maximum=15)
44
  steps = gr.Slider(label="steps", value=50, maximum=100, minimum=2)
45
  run = gr.Button(value="Run")
46
  gr.Markdown(f"Running on: {device}")
47
  with gr.Column():
48
- gallery = gr.Gallery(height=512)
49
 
50
- run.click(inference, inputs=[prompt, guidance, steps], outputs=gallery)
51
  gr.Examples([
52
  ["jason bateman disassembling the demon core, arcane style", 7.5, 50],
53
  ["portrait of dwayne johnson, arcane style", 7.0, 75],
54
  ["portrait of a beautiful alyx vance half life, volume lighting, concept art, by greg rutkowski!!, colorful, xray melting colors!!, arcane style", 7, 50],
55
  ["Aloy from Horizon: Zero Dawn, half body portrait, videogame cover art, highly detailed, digital painting, artstation, concept art, smooth, detailed armor, sharp focus, beautiful face, illustration, art by Artgerm and greg rutkowski and alphonse mucha, arcane style", 7, 50],
56
  ["fantasy portrait painting, digital art, arcane style", 4, 30],
57
- ], [prompt, guidance, steps], gallery, inference, cache_examples=torch.cuda.is_available())
58
  gr.HTML('''
59
  <div>
60
  <p>Model by <a href="https://huggingface.co/nitrosocke" style="text-decoration: underline;" target="_blank">@nitrosocke</a> ❤️</p>
 
8
  if torch.cuda.is_available():
9
  pipe = pipe.to("cuda")
10
 
11
+ def inference(prompt, guidance, steps):
12
+ prompt = prompt + " , arcane style"
13
+ image = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images[0]
14
+ return image
 
15
 
16
  with gr.Blocks() as demo:
17
  gr.HTML(
 
38
  with gr.Row():
39
 
40
  with gr.Column():
41
+ prompt = gr.Textbox(label="prompt", placeholder="' , arcane style' is appended automatically")
42
  guidance = gr.Slider(label="guidance scale", value=7.5, maximum=15)
43
  steps = gr.Slider(label="steps", value=50, maximum=100, minimum=2)
44
  run = gr.Button(value="Run")
45
  gr.Markdown(f"Running on: {device}")
46
  with gr.Column():
47
+ image_out = gr.Image(height=512)
48
 
49
+ run.click(inference, inputs=[prompt, guidance, steps], outputs=image_out)
50
  gr.Examples([
51
  ["jason bateman disassembling the demon core, arcane style", 7.5, 50],
52
  ["portrait of dwayne johnson, arcane style", 7.0, 75],
53
  ["portrait of a beautiful alyx vance half life, volume lighting, concept art, by greg rutkowski!!, colorful, xray melting colors!!, arcane style", 7, 50],
54
  ["Aloy from Horizon: Zero Dawn, half body portrait, videogame cover art, highly detailed, digital painting, artstation, concept art, smooth, detailed armor, sharp focus, beautiful face, illustration, art by Artgerm and greg rutkowski and alphonse mucha, arcane style", 7, 50],
55
  ["fantasy portrait painting, digital art, arcane style", 4, 30],
56
+ ], [prompt, guidance, steps], image_out, inference, cache_examples=torch.cuda.is_available())
57
  gr.HTML('''
58
  <div>
59
  <p>Model by <a href="https://huggingface.co/nitrosocke" style="text-decoration: underline;" target="_blank">@nitrosocke</a> ❤️</p>