File size: 1,656 Bytes
5463328
9d2fd29
4de66a5
5463328
 
 
 
 
 
 
 
 
 
 
 
 
 
0d7c941
 
5463328
 
 
8620a3e
5463328
 
8620a3e
5463328
68136c5
5463328
fcf476a
5463328
abcc6c7
1d8481c
5463328
 
1d8481c
 
5463328
7163d04
5463328
 
 
74a947f
1d8481c
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
33
34
35
36
37
38
39
40
41
42
43
44
import gradio
import accelerate

class Model:
    def __init__(self, name, path="", prefix=""):
        self.name = name
        self.path = path
        self.prefix = prefix

models = [
   Model("Marvel","models/ItsJayQz/Marvel_WhatIf_Diffusion", "whatif style"), 
   Model("Cyberpunk Anime Diffusion", "models/DGSpitzer/Cyberpunk-Anime-Diffusion", "dgs illustration style"),
   Model("Portrait plus", "models/wavymulder/portraitplus", "portrait+ style"),
   Model("classic Disney", "models/nitrosocke/classic-anim-diffusion", "classic disney style"),
   Model("vintedois", "models/22h/vintedois-diffusion-v0-1", "vintedois style"),
   Model("dreamlike", "models/dreamlike-art/dreamlike-diffusion-1.0","dreamlike style"),
   Model("SD21","models/stabilityai/stable-diffusion-2-1", "sd21 default style")
]

model2=[]
model3=[]

for i in range(len(models)):
    model3.append(models[i].name)
    model2.append(models[i].prefix)

def process1(prompt):
    modelSelected=''
    for i in range(len(models)):
        if prompt.find(models[i].prefix)!=-1:
            modelSelected=models[i].path
            print(modelSelected)
            m=gradio.Interface.load(modelSelected)
    if (modelSelected==''):
        modelSelected = "models/stabilityai/stable-diffusion-2-1"
        m=gradio.Interface.load(modelSelected)
    image_return = m(prompt)
    return image_return

sandbox = gradio.Interface(fn=process1, 
                        inputs=[gradio.Textbox(label="Enter Prompt:")],
                        outputs=[gradio.Image(label="Produced Image")], 
                        title='AlStable Text to Image')
sandbox.queue(concurrency_count=20).launch()