File size: 998 Bytes
3bd39c3 851d258 aa90372 3bd39c3 c64ef31 09bd06d 8bf10b5 aa90372 8bf10b5 aa90372 8f03093 8bf10b5 8f03093 |
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 31 32 33 34 35 36 37 38 |
import gradio as gr
import os
import spaces
import torch
from diffusers import DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained("segmind/tiny-sd")
pipeline.load_lora_weights(
"philipp-zettl/jon_juarez-lora",
hf_token=os.environ.get('HF_TOKEN')
)
pipe.to('cuda')
@spaces.GPU
def generate(prompt, negative_prompt, num_inference_steps, width, height):
return pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=num_inference_steps, width=width, height=height).images
app = gr.Interface(
fn=generate,
inputs=[
gr.Text(label="Prompt"),
gr.Text("", label="Negative Prompt"),
gr.Number(45, label="Number inference steps"),
gr.Number(1024, label='image width'),
gr.Number(1024, label='image height'),
],
outputs=gr.Gallery(),
)
with app as demo:
demo.examples = [
"Colorful line shading by JON_JUAREZ a dark cave with toxic mushrooms",
]
gr.Slider(label="seed")
demo.launch() |