vsrinivas commited on
Commit
16c32ca
1 Parent(s): 0feb041

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -16
app.py CHANGED
@@ -3,25 +3,13 @@ from transformers import pipeline
3
  import torch
4
  from diffusers import StableDiffusionPipeline
5
 
6
- def get_completion(prompt):
7
- return pipeline(prompt)['sample'][0]
8
-
9
- def generate(prompt, negative_prompt, steps, guidance, width, height):
10
- params = {
11
- "negative_prompt": negative_prompt,
12
- "num_inference_steps": steps,
13
- "guidance_scale": guidance,
14
- "width": width,
15
- "height": height
16
- }
17
 
18
- output = get_completion(prompt)
19
- # pil_image = base64_to_pil(output)
20
- # return pil_image
21
  return output
22
 
23
- pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
24
-
25
  with gr.Blocks() as demo:
26
  gr.Markdown("# Image Generation with Stable Diffusion")
27
  with gr.Row():
 
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=prompt, height=height, width=width, steps=steps, guidance=guidance, negative_prompt=negative_prompt)
 
11
  return output
12
 
 
 
13
  with gr.Blocks() as demo:
14
  gr.Markdown("# Image Generation with Stable Diffusion")
15
  with gr.Row():