File size: 539 Bytes
f04674c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr

from min_dalle import MinDalle
import torch

model = MinDalle(is_mega=True, models_root='./pretrained')

def text_to_image(text, grid_size=1):
    with torch.no_grad():
        return model.generate_image(text, grid_size=grid_size)


iface = gr.Interface(fn=text_to_image, 
                    inputs=[gr.Textbox(),gr.Number(value=1,precision=0)],
                    outputs='image',
                    title='Min-Dalle',
                    description="AI model generating images from any prompt!"
)
iface.launch()