File size: 510 Bytes
f49cc2f 25e4943 |
1 2 3 4 5 6 7 8 9 10 11 12 |
from requests import post
from io import BytesIO
from PIL.Image import open as open_image
from tkinter.simpledialog import askstring
while True:
text = askstring("IMAGE PROMPT",prompt="What is your prompt?")
if text and text.strip() != "":
hfapi = "<KEY>"
open_image(BytesIO(post("https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0", headers={"Authorization": f"Bearer {hfapi}"}, json={"inputs": text.strip()}).content)).show()
else:
break |