osanseviero commited on
Commit
d2bf6b2
·
1 Parent(s): 6e1a51e

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -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("osanseviero/my-llama"")
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=[256,256], type="pil", elem_id="output_image"),
22
+ title="Generate llama with diffusers!",
23
+ description="This demo the <a href=\"https://huggingface.co/osanseviero/my-llama\">my-llama</a> model to generate llama <a href="https://huggingface.co/osanseviero">osanseviero</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)