Spaces:
Runtime error
Runtime error
import os | |
import gradio as gr | |
from diffusers import DiffusionPipeline | |
from PIL import Image | |
import io | |
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0") | |
api_key = os.getenv("API_KEY") | |
def generate_image_with_stylization(prompt, style): | |
input_prompt = prompt | |
generated_image = pipeline.diffuse_text(input_prompt, stylize=True, style_prompt=style) | |
img = Image.fromarray(generated_image) | |
return img | |
title = "Stable Fiddusion XL" | |
description = "This app generates an image based on the provided prompt using the Stable Diffusion XL model, applying stylization." | |
gr.Interface( | |
fn=generate_image_with_stylization, | |
inputs=["text", gr.inputs.Textbox(label="Style")], | |
outputs="image", | |
title=title, | |
description=description | |
).launch() |