apolinario commited on
Commit
e9f0715
1 Parent(s): 45798af

third time is the charm

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -22,15 +22,15 @@ def text2image_latent(text,steps,width,height,images,diversity):
22
  image_str = image_str.replace("data:image/png;base64,","")
23
  decoded_bytes = base64.decodebytes(bytes(image_str, "utf-8"))
24
  img = Image.open(io.BytesIO(decoded_bytes))
25
- image_arrays.append(img)
26
- #url = shortuuid.uuid()
27
- #temp_dir = './tmp'
28
- #if not os.path.exists(temp_dir):
29
- # os.makedirs(temp_dir, exist_ok=True)
30
- #image_path = f'{temp_dir}/{url}.png'
31
- #img.save(f'{temp_dir}/{url}.png')
32
- #image_paths.append(image_path)
33
- return(results[0],image_arrays)
34
 
35
  def text2image_rudalle(text,aspect,model):
36
  image = rudalle(text,aspect,model)[0]
 
22
  image_str = image_str.replace("data:image/png;base64,","")
23
  decoded_bytes = base64.decodebytes(bytes(image_str, "utf-8"))
24
  img = Image.open(io.BytesIO(decoded_bytes))
25
+ #image_arrays.append(numpy.asarray(img))
26
+ url = shortuuid.uuid()
27
+ temp_dir = './tmp'
28
+ if not os.path.exists(temp_dir):
29
+ os.makedirs(temp_dir, exist_ok=True)
30
+ image_path = f'{temp_dir}/{url}.png'
31
+ img.save(f'{temp_dir}/{url}.png')
32
+ image_paths.append(image_path)
33
+ return(results[0],image_paths)
34
 
35
  def text2image_rudalle(text,aspect,model):
36
  image = rudalle(text,aspect,model)[0]