Spaces:
Runtime error
Runtime error
File size: 975 Bytes
673c0f9 |
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 29 30 |
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
# Load the pre-trained Stable Diffusion model
model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
def generate_one_line_art(prompt):
# Generate an image based on the text prompt
image = pipe(prompt).images[0]
# Convert the image to a simple one-line art (this is a placeholder)
# In practice, you would need a more sophisticated method to convert the image to one-line art.
# For simplicity, we'll just return the generated image.
return image
# Define the Gradio interface
iface = gr.Interface(
fn=generate_one_line_art,
inputs=gr.Textbox(lines=2, placeholder="Enter a text prompt..."),
outputs="image",
title="One-Line Art Generator",
description="Enter a text prompt to generate a simple one-line art."
)
# Launch the app
iface.launch() |