Spaces:
Runtime error
Runtime error
File size: 870 Bytes
83bb397 a3f2ded 9968452 a3f2ded 25eda14 9968452 a3f2ded 9968452 a3f2ded |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
pip install invisible-watermark
import gradio as gr
import torch
from diffusers import DiffusionPipeline
pip install invisible-watermark
# Load the pre-trained model from Hugging Face
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16)
pipe.to("cuda") # Ensure the model runs on the GPU if available
# Define the function for the Gradio interface
def generate_image(prompt):
# Generate an image using the provided prompt
image = pipe(prompt).images[0]
return image
# Set up the Gradio interface
interface = gr.Interface(
fn=generate_image,
inputs="text",
outputs="image",
title="Stable Diffusion XL Refiner",
description="Generate images from text prompts using Stable Diffusion XL Refiner 1.0"
)
# Launch the Gradio app
if __name__ == "__main__":
interface.launch() |