| from diffusers import DDPMPipeline | |
| import torch | |
| import PIL.Image | |
| import gradio as gr | |
| import random | |
| import numpy as np | |
| ddpm_pipeline = DDPMPipeline.from_pretrained("nateraw/my-aurora") | |
| def predict(seed=42): | |
| generator = torch.manual_seed(seed) | |
| images = ddpm_pipeline(generator=generator)["sample"] | |
| return images[0] | |
| random_seed = random.randint(0, 2147483647) | |
| gr.Interface( | |
| predict, | |
| inputs=[ | |
| gr.inputs.Slider(0, 2147483647, label='Seed', default=random_seed, step=1), | |
| ], | |
| outputs=gr.Image(shape=[32,32], type="pil", elem_id="output_image"), | |
| title="Generate aurora with diffusers!", | |
| description="This demo the <a href=\"https://huggingface.co/nateraw/my-aurora\">my-aurora</a> model to generate aurora created by <a href=\"https://huggingface.co/nateraw\">nateraw</a> using the <a href=\"https://github.com/osanseviero/diffuse-it\">Diffuse It! tool</a>. Inference might take around a minute.", | |
| ).launch(debug=True, enable_queue=True) | |