Spaces:
Runtime error
Runtime error
Create new file
Browse files
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=True, 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()
|