Nick088 commited on
Commit
828375c
1 Parent(s): 20e8960

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -29,7 +29,7 @@ pipe.to(device)
29
 
30
  # Define the image generation function
31
  @spaces.GPU(duration=60)
32
- def generate_image(prompt):
33
  image = pipe(
34
  prompt=prompt,
35
  negative_prompt=negative_prompt,
@@ -37,6 +37,7 @@ def generate_image(prompt):
37
  height=height,
38
  width=width,
39
  guidance_scale=guidance_scale,
 
40
  ).images[0]
41
  return image
42
 
@@ -48,15 +49,17 @@ negative_prompt = gr.Textbox(label="Negative Prompt", info="Describe what you do
48
 
49
  num_inference_steps = gr.Number(label="Number of Inference Steps", precision=0, value=25)
50
 
51
- height = gr.Number(label="Number of Inference Steps", precision=0, value=1024)
52
 
53
- width = gr.Number(label="Number of Inference Steps", precision=0, value=1024)
54
 
55
  guidance_scale = gr.Number(minimum=0.1, value=7.5, label="Guidance Scale", info="The number of denoising steps of the image. More denoising steps usually lead to a higher quality image at the cost of slower inference")
56
 
 
 
57
  interface = gr.Interface(
58
  fn=generate_image,
59
- inputs=[prompt, negative_prompt, num_inference_steps, height, width, guidance_scale],
60
  outputs="image",
61
  title="Stable Diffusion 3 Medium",
62
  description="Made by [Nick088](https://linktr.ee/Nick088"
 
29
 
30
  # Define the image generation function
31
  @spaces.GPU(duration=60)
32
+ def generate_image(prompt, negative_prompt, num_inference_steps, height, width, guidance_scale, num_images_per_prompt):
33
  image = pipe(
34
  prompt=prompt,
35
  negative_prompt=negative_prompt,
 
37
  height=height,
38
  width=width,
39
  guidance_scale=guidance_scale,
40
+ num_images_per_prompt=num_images_per_prompt
41
  ).images[0]
42
  return image
43
 
 
49
 
50
  num_inference_steps = gr.Number(label="Number of Inference Steps", precision=0, value=25)
51
 
52
+ height = gr.Slider(label="Height", info="Height of the Image", minimum=256, maximum="1536", step=32, value=1024)
53
 
54
+ width = gr.Slider(label="Width", info="Width of the Image", minimum=256, maximum="1536", step=32, value=1024)
55
 
56
  guidance_scale = gr.Number(minimum=0.1, value=7.5, label="Guidance Scale", info="The number of denoising steps of the image. More denoising steps usually lead to a higher quality image at the cost of slower inference")
57
 
58
+ num_images_per_prompt = gr.Slider(label="Number of Images to generate with the settings",minimum=1, maximum=4, step=1, value=1)
59
+
60
  interface = gr.Interface(
61
  fn=generate_image,
62
+ inputs=[prompt, negative_prompt, num_inference_steps, height, width, guidance_scale, num_images_per_prompt],
63
  outputs="image",
64
  title="Stable Diffusion 3 Medium",
65
  description="Made by [Nick088](https://linktr.ee/Nick088"