Spaces:
Running
Running
Commit
·
4f448b7
1
Parent(s):
0b1a6cb
Update app.py
Browse files
app.py
CHANGED
@@ -109,11 +109,19 @@ def create_readme(info, downloaded_files, link_civit=False, is_author=True, fold
|
|
109 |
original_url = f"https://civitai.com/models/{info['modelId']}"
|
110 |
link_civit_disclaimer = f'([CivitAI]({original_url}))'
|
111 |
non_author_disclaimer = f'This model was originally uploaded on [CivitAI]({original_url}), by [{info["creator"]}](https://civitai.com/user/{info["creator"]}/models). The information below was provided by the author on CivitAI:'
|
112 |
-
default_tags = ["text-to-image", "stable-diffusion", "lora", "diffusers"]
|
113 |
civit_tags = [t for t in info["tags"] if t not in default_tags]
|
114 |
-
widget_prompts = "\n- text: ".join(['"' + prompt.replace('"', '\\"') + '"' for prompt in downloaded_files["imagePrompt"] if prompt])
|
115 |
tags = default_tags + civit_tags
|
116 |
unpacked_tags = "\n- ".join(tags)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
content = f"""---
|
118 |
license: other
|
119 |
tags:
|
@@ -122,11 +130,13 @@ tags:
|
|
122 |
base_model: stabilityai/stable-diffusion-xl-base-1.0
|
123 |
instance_prompt: {info['trainedWords'][0] if 'trainedWords' in info and len(info['trainedWords']) > 0 else ''}
|
124 |
widget:
|
125 |
-
|
126 |
---
|
127 |
|
128 |
# {info["name"]}
|
129 |
|
|
|
|
|
130 |
{non_author_disclaimer if not is_author else ''}
|
131 |
|
132 |
![Image 0]({downloaded_files["imageName"][0]})
|
|
|
109 |
original_url = f"https://civitai.com/models/{info['modelId']}"
|
110 |
link_civit_disclaimer = f'([CivitAI]({original_url}))'
|
111 |
non_author_disclaimer = f'This model was originally uploaded on [CivitAI]({original_url}), by [{info["creator"]}](https://civitai.com/user/{info["creator"]}/models). The information below was provided by the author on CivitAI:'
|
112 |
+
default_tags = ["text-to-image", "stable-diffusion", "lora", "diffusers", "template:sd-lora"]
|
113 |
civit_tags = [t for t in info["tags"] if t not in default_tags]
|
|
|
114 |
tags = default_tags + civit_tags
|
115 |
unpacked_tags = "\n- ".join(tags)
|
116 |
+
|
117 |
+
widget_content = ""
|
118 |
+
for index, (prompt, image) in enumerate(zip(downloaded_files["imagePrompt"], downloaded_files["imageName"])):
|
119 |
+
widget_content += f"""- text: '{prompt}'
|
120 |
+
output:
|
121 |
+
url: >-
|
122 |
+
{image}
|
123 |
+
"""
|
124 |
+
|
125 |
content = f"""---
|
126 |
license: other
|
127 |
tags:
|
|
|
130 |
base_model: stabilityai/stable-diffusion-xl-base-1.0
|
131 |
instance_prompt: {info['trainedWords'][0] if 'trainedWords' in info and len(info['trainedWords']) > 0 else ''}
|
132 |
widget:
|
133 |
+
{widget_content}
|
134 |
---
|
135 |
|
136 |
# {info["name"]}
|
137 |
|
138 |
+
<Gallery />
|
139 |
+
|
140 |
{non_author_disclaimer if not is_author else ''}
|
141 |
|
142 |
![Image 0]({downloaded_files["imageName"][0]})
|