Prgckwb commited on
Commit
2b72305
1 Parent(s): cc38d5a

:tada: add external model

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -11,11 +11,11 @@ DIFFUSERS_MODEL_IDS = [
11
  "runwayml/stable-diffusion-v1-5",
12
  ]
13
 
14
- EXTERNAL_MODEL_URL_MAPPING = {
15
- "Beautiful Realistic Asians": "https://civitai.com/api/download/models/177164?type=Model&format=SafeTensor&size=full&fp=fp16",
16
  }
17
 
18
- MODEL_CHOICES = DIFFUSERS_MODEL_IDS + list(EXTERNAL_MODEL_URL_MAPPING.keys())
19
 
20
  # Global Variables
21
  current_model_id = "stabilityai/stable-diffusion-3-medium-diffusers"
@@ -43,6 +43,9 @@ def inference(
43
 
44
  if model_id != current_model_id:
45
  try:
 
 
 
46
  pipe = DiffusionPipeline.from_pretrained(
47
  model_id,
48
  torch_dtype=torch.float16,
 
11
  "runwayml/stable-diffusion-v1-5",
12
  ]
13
 
14
+ EXTERNAL_MODEL_MAPPING = {
15
+ "Beautiful Realistic Asians": "checkpoints/diffusers/Beautiful Realistic Asians v7",
16
  }
17
 
18
+ MODEL_CHOICES = DIFFUSERS_MODEL_IDS + list(EXTERNAL_MODEL_MAPPING.keys())
19
 
20
  # Global Variables
21
  current_model_id = "stabilityai/stable-diffusion-3-medium-diffusers"
 
43
 
44
  if model_id != current_model_id:
45
  try:
46
+ if model_id not in DIFFUSERS_MODEL_IDS:
47
+ model_id = EXTERNAL_MODEL_MAPPING[model_id]
48
+
49
  pipe = DiffusionPipeline.from_pretrained(
50
  model_id,
51
  torch_dtype=torch.float16,