ka1kuk commited on
Commit
5c7905f
·
1 Parent(s): 71ffd22

Create photo.py

Browse files
Files changed (1) hide show
  1. photo.py +15 -0
photo.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
2
+ import torch
3
+
4
+ def dummy(images, **kwargs):
5
+ return images, False
6
+
7
+ async def Gimager(prompt):
8
+ model_id = "SG161222/Realistic_Vision_V1.4"
9
+ scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
10
+ pipe = await StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
11
+ pipe = pipe.to("cuda")
12
+ pipe.safety_checker = dummy
13
+ image = await pipe(prompt).images[0]
14
+ return image
15
+