morgengc commited on
Commit
35035b4
Β·
1 Parent(s): 79506a4

Add application file

Browse files
Files changed (2) hide show
  1. app.py +9 -0
  2. requirements.txt +6 -0
app.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
2
+
3
+ model_id = "stabilityai/stable-diffusion-2"
4
+ scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
5
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
6
+ pipe = pipe.to("cuda")
7
+
8
+ prompt = "a photo of an astronaut riding a horse on mars"
9
+ image = pipe(prompt).images[0]
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ torch
2
+ diffusers
3
+ transformers
4
+ accelerate
5
+ scipy
6
+ safetensors