Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -5,14 +5,17 @@ from diffusers import DiffusionPipeline
5
  pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo")
6
 
7
  @spaces.GPU(duration=250)
8
- def generate_image(prompt):
9
  # Run the diffusion model to generate an image
10
- output = pipe(prompt, num_inference_steps=50, guidance_scale=7.5)
11
  return output.images[0]
12
 
 
 
 
13
  gr_interface = gr.Interface(
14
  fn=generate_image,
15
- inputs="text",
16
  outputs="image",
17
  title="Real-time Image Generation with Diffusion",
18
  description="Enter a prompt to generate an image",
 
5
  pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo")
6
 
7
  @spaces.GPU(duration=250)
8
+ def generate_image(prompt, negative_prompt):
9
  # Run the diffusion model to generate an image
10
+ output = pipe(prompt, negative_prompt, num_inference_steps=50, guidance_scale=7.5)
11
  return output.images[0]
12
 
13
+ prompt = gr.Textbox(label = "Prompt", info = "Describe the subject, the background and the style of image; 77 token limit", placeholder = "Describe what you want to see", lines = 2)
14
+ negative_prompt = gr.Textbox(label = "Negative prompt", placeholder = "Describe what you do NOT want to see", value = "Ugly, malformed, noise, blur, watermark")
15
+
16
  gr_interface = gr.Interface(
17
  fn=generate_image,
18
+ inputs=[prompt, negative_prompt],
19
  outputs="image",
20
  title="Real-time Image Generation with Diffusion",
21
  description="Enter a prompt to generate an image",