Commit
·
3ea6729
1
Parent(s):
329af54
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,7 +21,6 @@ def text2image_latent(text,steps,width,height,images,diversity):
|
|
| 21 |
image_str = image_str.replace("data:image/png;base64,","")
|
| 22 |
decoded_bytes = base64.decodebytes(bytes(image_str, "utf-8"))
|
| 23 |
img = Image.open(io.BytesIO(decoded_bytes))
|
| 24 |
-
#image_arrays.append(numpy.asarray(img))
|
| 25 |
url = shortuuid.uuid()
|
| 26 |
temp_dir = './tmp'
|
| 27 |
if not os.path.exists(temp_dir):
|
|
@@ -39,8 +38,8 @@ def text2image_vqgan(text,width,height,style,steps,flavor):
|
|
| 39 |
results = vqgan(text,width,height,style,steps,flavor)
|
| 40 |
return([results])
|
| 41 |
|
| 42 |
-
def text2image_diffusion(steps_diff, images_diff, weight, clip):
|
| 43 |
-
results = diffusion(steps_diff, images_diff, weight, clip)
|
| 44 |
image_paths = []
|
| 45 |
image_arrays = []
|
| 46 |
for image in results:
|
|
@@ -107,5 +106,5 @@ with gr.Blocks() as mindseye:
|
|
| 107 |
get_image_latent.click(text2image_latent, inputs=[text,steps,width,height,images,diversity], outputs=gallery)
|
| 108 |
get_image_rudalle.click(text2image_rudalle, inputs=[text,aspect,model], outputs=gallery)
|
| 109 |
get_image_vqgan.click(text2image_vqgan, inputs=[text,width_vq,height_vq,style,steps,flavor],outputs=gallery)
|
| 110 |
-
get_image_diffusion.click(text2image_diffusion, inputs=[steps_diff, images_diff, weight, clip],outputs=gallery)
|
| 111 |
mindseye.launch()
|
|
|
|
| 21 |
image_str = image_str.replace("data:image/png;base64,","")
|
| 22 |
decoded_bytes = base64.decodebytes(bytes(image_str, "utf-8"))
|
| 23 |
img = Image.open(io.BytesIO(decoded_bytes))
|
|
|
|
| 24 |
url = shortuuid.uuid()
|
| 25 |
temp_dir = './tmp'
|
| 26 |
if not os.path.exists(temp_dir):
|
|
|
|
| 38 |
results = vqgan(text,width,height,style,steps,flavor)
|
| 39 |
return([results])
|
| 40 |
|
| 41 |
+
def text2image_diffusion(text,steps_diff, images_diff, weight, clip):
|
| 42 |
+
results = diffusion(text, steps_diff, images_diff, weight, clip)
|
| 43 |
image_paths = []
|
| 44 |
image_arrays = []
|
| 45 |
for image in results:
|
|
|
|
| 106 |
get_image_latent.click(text2image_latent, inputs=[text,steps,width,height,images,diversity], outputs=gallery)
|
| 107 |
get_image_rudalle.click(text2image_rudalle, inputs=[text,aspect,model], outputs=gallery)
|
| 108 |
get_image_vqgan.click(text2image_vqgan, inputs=[text,width_vq,height_vq,style,steps,flavor],outputs=gallery)
|
| 109 |
+
get_image_diffusion.click(text2image_diffusion, inputs=[text, steps_diff, images_diff, weight, clip],outputs=gallery)
|
| 110 |
mindseye.launch()
|