asahi417 commited on
Commit
66bb064
1 Parent(s): c7bd22a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -4,6 +4,7 @@ from panna import SD3
4
 
5
 
6
  model = SD3("stabilityai/stable-diffusion-3-medium-diffusers")
 
7
  examples = [
8
  "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
9
  "A female model, high quality, fashion, Paris, Vogue, Maison Margiela, 8k",
@@ -18,7 +19,7 @@ css = """
18
 
19
  @spaces.GPU
20
  def infer(prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps):
21
- image = model.text2image(
22
  prompt=[prompt],
23
  negative_prompt=[negative_prompt],
24
  guidance_scale=guidance_scale,
@@ -26,13 +27,12 @@ def infer(prompt, negative_prompt, seed, width, height, guidance_scale, num_infe
26
  width=width,
27
  height=height,
28
  seed=seed
29
- )
30
- return image[0]
31
 
32
 
33
  with gr.Blocks(css=css) as demo:
34
  with gr.Column(elem_id="col-container"):
35
- gr.Markdown("# Demo [Stable Diffusion 3 Medium](https://huggingface.co/stabilityai/stable-diffusion-3-medium)")
36
  with gr.Row():
37
  prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt", container=False)
38
  run_button = gr.Button("Run", scale=0)
@@ -45,7 +45,7 @@ with gr.Blocks(css=css) as demo:
45
  height = gr.Slider(label="Height", minimum=256, maximum=1344, step=64, value=1024)
46
  with gr.Row():
47
  guidance_scale = gr.Slider(label="Guidance scale", minimum=0.0, maximum=10.0, step=0.1, value=7.5)
48
- num_inference_steps = gr.Slider(label="Inference steps", minimum=1, maximum=50, step=1, value=5)
49
  gr.Examples(examples=examples, inputs=[prompt])
50
  gr.on(
51
  triggers=[run_button.click, prompt.submit, negative_prompt.submit],
 
4
 
5
 
6
  model = SD3("stabilityai/stable-diffusion-3-medium-diffusers")
7
+ title = "# [Stable Diffusion 3 Medium](https://huggingface.co/stabilityai/stable-diffusion-3-medium)"
8
  examples = [
9
  "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
10
  "A female model, high quality, fashion, Paris, Vogue, Maison Margiela, 8k",
 
19
 
20
  @spaces.GPU
21
  def infer(prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps):
22
+ return model.text2image(
23
  prompt=[prompt],
24
  negative_prompt=[negative_prompt],
25
  guidance_scale=guidance_scale,
 
27
  width=width,
28
  height=height,
29
  seed=seed
30
+ )[0]
 
31
 
32
 
33
  with gr.Blocks(css=css) as demo:
34
  with gr.Column(elem_id="col-container"):
35
+ gr.Markdown(title)
36
  with gr.Row():
37
  prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt", container=False)
38
  run_button = gr.Button("Run", scale=0)
 
45
  height = gr.Slider(label="Height", minimum=256, maximum=1344, step=64, value=1024)
46
  with gr.Row():
47
  guidance_scale = gr.Slider(label="Guidance scale", minimum=0.0, maximum=10.0, step=0.1, value=7.5)
48
+ num_inference_steps = gr.Slider(label="Inference steps", minimum=1, maximum=50, step=1, value=50)
49
  gr.Examples(examples=examples, inputs=[prompt])
50
  gr.on(
51
  triggers=[run_button.click, prompt.submit, negative_prompt.submit],