multimodalart HF staff commited on
Commit
4d371f5
1 Parent(s): ea1645b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -35,7 +35,7 @@ def check_nsfw(json_data, profile):
35
  def extract_info(json_data):
36
  if json_data["type"] == "LORA":
37
  for model_version in json_data["modelVersions"]:
38
- if model_version["baseModel"] in ["SDXL 1.0", "SDXL 0.9"]:
39
  for file in model_version["files"]:
40
  if file["primary"]:
41
  # Start by adding the primary file to the list
@@ -52,10 +52,21 @@ def extract_info(json_data):
52
  "type": "imageName",
53
  "prompt": image["meta"]["prompt"] if image["meta"] is not None and "prompt" in image["meta"] else ""
54
  })
55
-
 
 
 
 
 
 
 
 
 
 
56
  info = {
57
  "urls_to_download": urls_to_download,
58
  "id": model_version["id"],
 
59
  "modelId": model_version["modelId"],
60
  "name": json_data["name"],
61
  "description": json_data["description"],
@@ -131,7 +142,7 @@ license: other
131
  tags:
132
  - {unpacked_tags}
133
 
134
- base_model: stabilityai/stable-diffusion-xl-base-1.0
135
  instance_prompt: {info['trainedWords'][0] if 'trainedWords' in info and len(info['trainedWords']) > 0 else ''}
136
  widget:
137
  {widget_content}
 
35
  def extract_info(json_data):
36
  if json_data["type"] == "LORA":
37
  for model_version in json_data["modelVersions"]:
38
+ if model_version["baseModel"] in ["SDXL 1.0", "SDXL 0.9", "SD 1.5", "SD 1.4", "SD 2.1", "SD 2.0", "SD 2.0 768", "SD 2.1 768"]:
39
  for file in model_version["files"]:
40
  if file["primary"]:
41
  # Start by adding the primary file to the list
 
52
  "type": "imageName",
53
  "prompt": image["meta"]["prompt"] if image["meta"] is not None and "prompt" in image["meta"] else ""
54
  })
55
+ model_mapping = {
56
+ "SDXL 1.0": "stabilityai/stable-diffusion-xl-base-1.0",
57
+ "SDXL 0.9": "stabilityai/stable-diffusion-xl-base-1.0",
58
+ "SD 1.5": "runwayml/stable-diffusion-v1-5",
59
+ "SD 1.4": "CompVis/stable-diffusion-v1-4",
60
+ "SD 2.1": "stabilityai/stable-diffusion-2-1-base",
61
+ "SD 2.0": "stabilityai/stable-diffusion-2-base",
62
+ "SD 2.1 768": "stabilityai/stable-diffusion-2-1",
63
+ "SD 2.0 768": "stabilityai/stable-diffusion-2"
64
+ }
65
+ base_model = model_mapping[model_version["baseModel"]]
66
  info = {
67
  "urls_to_download": urls_to_download,
68
  "id": model_version["id"],
69
+ "baseModel": base_model,
70
  "modelId": model_version["modelId"],
71
  "name": json_data["name"],
72
  "description": json_data["description"],
 
142
  tags:
143
  - {unpacked_tags}
144
 
145
+ base_model: {info["baseModel"]}
146
  instance_prompt: {info['trainedWords'][0] if 'trainedWords' in info and len(info['trainedWords']) > 0 else ''}
147
  widget:
148
  {widget_content}