import gradio as gr import requests API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2" headers = {"Authorization": "Bearer YOUR_HF_API_KEY"} def generate_carousel(text): prompt = f""" A minimal clean Studio Ghibli style background illustration, soft pastel colors, flat design, aesthetic. Leave empty space in the center for text. Add a small branded avatar of [Your Ghibli-style face] in the bottom right corner. Overlay this text in bold clean white typography: "{text}". Aspect ratio 4:5, Instagram carousel slide, professional design. """ payload = {"inputs": prompt} response = requests.post(API_URL, headers=headers, json=payload) image = response.content return image with gr.Blocks() as demo: gr.Markdown("# 🎨 AI Carousel Generator (Ghibli Style)") text = gr.Textbox(label="Enter Carousel Text", placeholder="Write your slide text here...") output = gr.Image(type="pil") btn = gr.Button("Generate Carousel Slide") btn.click(fn=generate_carousel, inputs=text, outputs=output) demo.launch()