|
|
|
import gradio as gr |
|
from diffusers import StableDiffusionPipeline |
|
import torch |
|
|
|
|
|
pipe = StableDiffusionPipeline.from_pretrained( |
|
"Linaqruf/anything-v3.0", |
|
torch_dtype=torch.float16, |
|
revision="fp16", |
|
safety_checker=None |
|
).to("cuda" if torch.cuda.is_available() else "cpu") |
|
|
|
def generate_thumbnail(prompt): |
|
image = pipe(prompt, height=512, width=512).images[0] |
|
return image |
|
|
|
|
|
iface = gr.Interface( |
|
fn=generate_thumbnail, |
|
inputs=gr.Textbox(label="Thumbnail Prompt"), |
|
outputs=gr.Image(label="Generated Thumbnail"), |
|
title="Anime Thumbnail Generator", |
|
description="Generate thumbnails using Linaqruf/anything-v3.0 model" |
|
) |
|
|
|
iface.launch() |