kamalkraj commited on
Commit
a57a679
1 Parent(s): 75fbd2d

Create new file

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from min_dalle import MinDalle
4
+ import torch
5
+
6
+ model = MinDalle(is_mega=False, models_root='./pretrained')
7
+
8
+ def text_to_image(text, grid_size=1):
9
+ with torch.no_grad():
10
+ return model.generate_image(text, grid_size=grid_size)
11
+
12
+
13
+ iface = gr.Interface(fn=text_to_image,
14
+ inputs=[gr.Textbox(),gr.Number(value=1,precision=0)],
15
+ outputs='image',
16
+ title='Min-Dalle',
17
+ description="AI model generating images from any prompt!"
18
+ )
19
+ iface.launch()