AlStable commited on
Commit
f5f9986
1 Parent(s): abcc6c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -17,24 +17,23 @@ models = [
17
  Model("SD21","models/stabilityai/stable-diffusion-2-1", "sd21 default style")
18
  ]
19
 
 
20
  model2=[]
21
  model3=[]
22
 
23
  for i in range(len(models)):
24
  model3.append(models[i].name)
25
  model2.append(models[i].prefix)
 
26
 
27
  def process1(prompt):
28
- modelSelected=''
29
  for i in range(len(models)):
30
  if prompt.find(models[i].prefix)!=-1:
31
  modelSelected=models[i].path
32
- print(modelSelected)
33
- m=gradio.Interface.load(modelSelected)
34
- if (modelSelected==''):
35
- modelSelected = "models/stabilityai/stable-diffusion-2-1"
36
- m=gradio.Interface.load(modelSelected)
37
- image_return = m(prompt)
38
  return image_return
39
 
40
  sandbox = gradio.Interface(fn=process1,
 
17
  Model("SD21","models/stabilityai/stable-diffusion-2-1", "sd21 default style")
18
  ]
19
 
20
+ model1=[]
21
  model2=[]
22
  model3=[]
23
 
24
  for i in range(len(models)):
25
  model3.append(models[i].name)
26
  model2.append(models[i].prefix)
27
+ model1.append(gradio.Interface.load(models[i].path))
28
 
29
  def process1(prompt):
30
+ modelSelected='models/stabilityai/stable-diffusion-2-1'
31
  for i in range(len(models)):
32
  if prompt.find(models[i].prefix)!=-1:
33
  modelSelected=models[i].path
34
+ print(modelSelected)
35
+ model_idx=model3.index(modelSelected)
36
+ image_return = model1[model_idx](prompt)
 
 
 
37
  return image_return
38
 
39
  sandbox = gradio.Interface(fn=process1,