from asyncio import constants import gradio as gr import requests import os from base64 import b64decode from PIL import Image import io def generate_image(text): #dalle = gr.Interface.load("spaces/kuprel/min-dalle") dalle = gr.Interface.load("spaces/Axolotlily/DalleMini") print("calling interface",text) img=dalle(text) #img=dalle.fns[0].fn(seed,psi) #header, encoded = img.split(",", 1) #data = b64decode(encoded) #image = Image.open(io.BytesIO(data)) return img #gfpgan=gr.Interface.load("spaces/akhaliq/GFPGAN") #img2=dalle(image) #return img2 demo = gr.Blocks() with demo: gr.Markdown("

StyleGan-Human + PIFu

") gr.Markdown( "create an image with min-dalle then fix faces with grpgan" ) with gr.Row(): b0 = gr.Button("generate image") with gr.Row(): text=gr.Text(default="three pigs in a trenchcoat", label='Seed') #outputImage = gr.Image(label="portrait",type="filepath", shape=(256,256)) output_image = gr.outputs.Image(type="filepath", label='Output') b0.click(generate_image,inputs=[text],outputs=[output_image]) demo.launch(enable_queue=True, debug=True)