nightfury commited on
Commit
eba01f5
·
1 Parent(s): 39c7b93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -14,11 +14,11 @@ print(device)
14
  pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=auth_token, revision="fp16", torch_dtype=torch.float32)
15
  pipe = pipe.to(device)
16
 
17
- #stable_diffusion = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")
18
 
19
- #def get_images(prompt):
20
- # gallery_dir = stable_diffusion(prompt, fn_index=2)
21
- # return [os.path.join(gallery_dir, img) for img in os.listdir(gallery_dir)]
22
 
23
 
24
  def infer(prompt, samples, steps, scale, seed):
@@ -39,7 +39,6 @@ def infer(prompt, samples, steps, scale, seed):
39
  # images.append(image)
40
  return images
41
 
42
-
43
  block = gr.Blocks()
44
 
45
  with block:
@@ -87,4 +86,12 @@ with block:
87
  text,
88
  )
89
 
 
 
 
 
 
 
 
 
90
  block.launch()
 
14
  pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=auth_token, revision="fp16", torch_dtype=torch.float32)
15
  pipe = pipe.to(device)
16
 
17
+ stable_diffusion = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")
18
 
19
+ def get_images(prompt):
20
+ gallery_dir = stable_diffusion(prompt, fn_index=2)
21
+ return [os.path.join(gallery_dir, img) for img in os.listdir(gallery_dir)]
22
 
23
 
24
  def infer(prompt, samples, steps, scale, seed):
 
39
  # images.append(image)
40
  return images
41
 
 
42
  block = gr.Blocks()
43
 
44
  with block:
 
86
  text,
87
  )
88
 
89
+
90
+ output = gr.Textbox(label="Output Box")
91
+ sd_output = gr.Gallery().style(grid=2, height="auto")
92
+
93
+ submit_audio_button.click(fn=transcribe, inputs=audio_input, outputs=text_output)
94
+ text_output.change(fn=get_images, inputs=text_output, outputs=sd_output)
95
+ submit_button_text.click(fn=get_images, inputs=text_input, outputs=sd_output)
96
+
97
  block.launch()