File size: 915 Bytes
74a947f
 
4de66a5
9d2fd29
4de66a5
74a947f
8620a3e
 
 
 
 
 
 
0d7c941
 
8620a3e
 
 
74a947f
 
9d2fd29
74a947f
 
 
 
7163d04
74a947f
 
c1e0059
74a947f
acda1ca
74a947f
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
26
27
28
29
30
31
32
from diffusers import StableDiffusionPipeline
import torch
import gradio as gr
import accelerate

models=[
"ItsJayQz/Marvel_WhatIf_Diffusion",
"DGSpitzer/Cyberpunk-Anime-Diffusion",
"wavymulder/portraitplus",
"nitrosocke/classic-anim-diffusion",
"22h/vintedois-diffusion-v0-1",
"dreamlike-art/dreamlike-diffusion-1.0",
"stabilityai/stable-diffusion-2-1"
]

for i in range(len(models)):
     gr.Interface.load(f"models/{models[i]}",live=True,preprocess=True)

def TextToImage(Prompt,model):
  model_id = model
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.get_default_dtype())
  pipe = pipe.to("cpu")
  prompt = Prompt
  image = pipe(prompt).images[0]
  return image

sandbox = gr.Interface(fn=TextToImage, 
                        inputs=["text", gr.Dropdown(models)],
                        outputs="image", 
                        title='AlStable Text to Image')

sandbox.launch()