import os import gradio as gr from huggingface_hub import InferenceClient class Text_to_image: def __init__(self): HUGGINGFACE_API_TOKEN=os.getenv("HUGGINGFACE_API_TOKEN") self.client = InferenceClient(token=HUGGINGFACE_API_TOKEN,model="stabilityai/stable-diffusion-xl-base-1.0") def text_to_image(self,prompt): image = self.client.text_to_image(prompt) return image def gradio_interface(self): with gr.Blocks(theme='JohnSmith9982/small_and_pretty',css="style.css") as demo: gr.HTML("""