thefreeham commited on
Commit
ab690cb
·
1 Parent(s): df5b9cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -13
app.py CHANGED
@@ -8,20 +8,19 @@ import numpy as np
8
  ldm = DiffusionPipeline.from_pretrained("fusing/latent-diffusion-text2im-large")
9
 
10
  generator = torch.manual_seed(42)
11
-
12
- prompt = "A painting of a squirrel eating a burger"
13
- image = ldm([prompt], generator=generator, eta=0.3, guidance_scale=6.0, num_inference_steps=50)
14
-
15
- image_processed = image.cpu().permute(0, 2, 3, 1)
16
- image_processed = image_processed * 255.
17
- image_processed = image_processed.numpy().astype(np.uint8)
18
- image_pil = PIL.Image.fromarray(image_processed[0])
19
-
20
- # save image
21
- image_pil.save("test.png")
22
 
23
  def greet(name):
24
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
25
 
26
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
27
  iface.launch()
 
8
  ldm = DiffusionPipeline.from_pretrained("fusing/latent-diffusion-text2im-large")
9
 
10
  generator = torch.manual_seed(42)
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  def greet(name):
13
+ prompt = "A painting of a squirrel eating a burger"
14
+ image = ldm([prompt], generator=generator, eta=0.3, guidance_scale=6.0, num_inference_steps=50)
15
+
16
+ image_processed = image.cpu().permute(0, 2, 3, 1)
17
+ image_processed = image_processed * 255.
18
+ image_processed = image_processed.numpy().astype(np.uint8)
19
+ image_pil = PIL.Image.fromarray(image_processed[0])
20
+
21
+ # save image
22
+ image_pil.save("test.png")
23
+ return "Hello " + prompt + "!!"
24
 
25
+ iface = gr.Interface(fn=greet, inputs="text", outputs=[image,gr.outputs.Carousel(label="Individual images",components=["image_pil"]),gr.outputs.Textbox(label="Error")])
26
  iface.launch()