File size: 1,151 Bytes
594459e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from diffusers import DiffusionPipeline as Pipe
import torch
class Generador:
def using_runway_sd_15(prompt:str)->list:
_generador = Pipe.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
_generador.to("cuda")
_imagen = _generador(prompt).images[0]
return list(_imagen.getdata())
def using_stability_sd_21(prompt:str)->list:
_generador = Pipe.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16)
_generador.to("cuda")
_imagen = _generador(prompt).images[0]
return list(_imagen.getdata())
def using_realistic_v14(prompt:str)->list:
_generador = Pipe.from_pretrained("SG161222/Realistic_Vision_V1.4", torch_dtype=torch.float16)
_generador.to("cuda")
_imagen = _generador(prompt).images[0]
return list(_imagen.getdata())
def using_prompthero_openjourney(prompt:str)->list:
_generador = Pipe.from_pretrained("prompthero/openjourney", torch_dtype=torch.float16)
_generador.to("cuda")
_imagen = _generador(prompt).images[0]
return list(_imagen.getdata())
|