vsrinivas commited on
Commit
27c42f2
1 Parent(s): 308e0c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -3,11 +3,19 @@ from transformers import pipeline
3
  import torch
4
  from diffusers import StableDiffusionPipeline
5
 
6
- def get_completion(prompt,negative_prompt,steps,guidance,width,height):
7
- return pipeline(prompt=prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=guidance, negative_prompt=negative_prompt)['sample'][0]
 
8
 
9
  def generate(prompt,negative_prompt,steps,guidance,width,height):
10
- output = get_completion(prompt,negative_prompt,steps,guidance,width,height)
 
 
 
 
 
 
 
11
  return output
12
 
13
  pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
 
3
  import torch
4
  from diffusers import StableDiffusionPipeline
5
 
6
+ def get_completion(prompt,params):
7
+ # return pipeline(prompt=prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=guidance, negative_prompt=negative_prompt)['sample'][0]
8
+ return pipeline(prompt=prompt, params=params)['sample'][0]
9
 
10
  def generate(prompt,negative_prompt,steps,guidance,width,height):
11
+ params = {
12
+ "negative_prompt": negative_prompt,
13
+ "num_inference_steps": steps,
14
+ "guidance_scale": guidance,
15
+ "width": width,
16
+ "height": height
17
+ }
18
+ output = get_completion(prompt,params)
19
  return output
20
 
21
  pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)