Spaces:
Runtime error
Runtime error
File size: 889 Bytes
4818440 6e838ef 4818440 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio as gr
import urllib
from PIL import Image
karlo = gr.Interface.load(name="spaces/kakaobrain/karlo")
def get_images(prompt):
try:
gallery_dir = karlo(prompt, fn_index=1)
except Exception as e:
text=str(e)
url = "https://kakaobrain-karlo.hf.space/file="+text[38:len(text)-1]
save_as = "file.png"
data1 = urllib.request.urlopen(url)
f = open(save_as,'wb')
f.write(data1.read())
f.close()
img = Image.open(save_as)
return img
demo=gr.Interface(fn=get_images,
inputs="text",
outputs="image",
examples=[["A man with a face of avocado, in the drawing style of Rene Magritte"], ["a black porcelain in the shape of pikachu"], ["a portrait of an old monk, highly detailed"], ["A teddy bear on a skateboard, children drawing style."]],
title="Karlo CPU/API")
demo.launch(debug=True) |