anzorq commited on
Commit
5a53a51
1 Parent(s): 9a9456e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from PIL import Image
2
  import torch
3
 
@@ -94,11 +95,13 @@ def get_sampler(model_name, txt2obj, guidance_scale):
94
  )
95
 
96
  def generate_txt2img(prompt):
97
- prompt = f"“a 3d rendering of {prompt}, chair imitating an avocado, full view, white background"
98
  stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
99
- image = stable_diffusion(prompt, fn_index=2)[0]
 
 
100
 
101
- return image, gr.update(visible=True)
102
 
103
 
104
  def generate_3D(input, model_name='base40M', guidance_scale=3.0, grid_size=32):
 
1
+ import os
2
  from PIL import Image
3
  import torch
4
 
 
95
  )
96
 
97
  def generate_txt2img(prompt):
98
+
99
  stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
100
+ prompt = f"“a 3d rendering of {prompt}, chair imitating an avocado, full view, white background"
101
+ gallery_dir = stable_diffusion(prompt, fn_index=2)[0]
102
+ imgs = [os.path.join(gallery_dir, img) for img in os.listdir(gallery_dir)]
103
 
104
+ return imgs[1], gr.update(visible=True)
105
 
106
 
107
  def generate_3D(input, model_name='base40M', guidance_scale=3.0, grid_size=32):