|
import gradio as gr |
|
import diffusers |
|
def update(): |
|
try: |
|
pipeline.to("cuda") |
|
except: |
|
pass |
|
images= pipeline().images |
|
print(images) |
|
im = images[0] |
|
return im |
|
|
|
scheduler = diffusers.PNDMScheduler(num_train_timesteps=1100) |
|
pipeline = diffusers.PNDMPipeline.from_pretrained("uripper/GIANNIS", scheduler=scheduler) |
|
|
|
css = """ |
|
.container { |
|
max-width: 512px; |
|
max-height: 512px; |
|
margin: auto; |
|
padding-top: 1.5rem; |
|
} |
|
""" |
|
block = gr.Blocks(css=css) |
|
|
|
with block as demo: |
|
with gr.Row(): |
|
out = gr.Image() |
|
btn = gr.Button("Generate") |
|
btn.click(update, inputs=None, outputs=out) |
|
demo.launch() |
|
|