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 = "" 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