nateraw commited on
Commit
61d6415
1 Parent(s): 68c2ff7

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import DDPMPipeline
2
+ import torch
3
+ import PIL.Image
4
+ import gradio as gr
5
+ import random
6
+ import numpy as np
7
+
8
+ ddpm_pipeline = DDPMPipeline.from_pretrained("nateraw/my-aurora")
9
+
10
+ def predict(seed=42):
11
+ generator = torch.manual_seed(seed)
12
+ images = ddpm_pipeline(generator=generator)["sample"]
13
+ return images[0]
14
+
15
+ random_seed = random.randint(0, 2147483647)
16
+ gr.Interface(
17
+ predict,
18
+ inputs=[
19
+ gr.inputs.Slider(0, 2147483647, label='Seed', default=random_seed, step=1),
20
+ ],
21
+ outputs=gr.Image(shape=[32,32], type="pil", elem_id="output_image"),
22
+ title="Generate aurora with diffusers!",
23
+ 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.",
24
+ ).launch(debug=True, enable_queue=True)