Spaces:
Build error
Build error
change metadata label to parameters
Browse files
app.py
CHANGED
@@ -107,7 +107,7 @@ def generate(
|
|
107 |
|
108 |
if use_upscaler:
|
109 |
upscaler_pipe = StableDiffusionXLImg2ImgPipeline(**pipe.components)
|
110 |
-
|
111 |
"prompt": prompt,
|
112 |
"negative_prompt": negative_prompt,
|
113 |
"resolution": f"{width} x {height}",
|
@@ -118,23 +118,25 @@ def generate(
|
|
118 |
"sdxl_style": style_selector,
|
119 |
"add_quality_tags": add_quality_tags,
|
120 |
"quality_tags": quality_selector,
|
121 |
-
"Model hash": "e3c47aedb0",
|
122 |
-
"Model": "animagine-xl-3.1",
|
123 |
}
|
124 |
|
125 |
if use_upscaler:
|
126 |
new_width = int(width * upscale_by)
|
127 |
new_height = int(height * upscale_by)
|
128 |
-
|
129 |
"upscale_method": "nearest-exact",
|
130 |
"upscaler_strength": upscaler_strength,
|
131 |
"upscale_by": upscale_by,
|
132 |
"new_resolution": f"{new_width} x {new_height}",
|
133 |
}
|
134 |
else:
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
138 |
|
139 |
try:
|
140 |
if use_upscaler:
|
@@ -173,14 +175,14 @@ def generate(
|
|
173 |
|
174 |
if images:
|
175 |
image_paths = [
|
176 |
-
utils.save_image(image,
|
177 |
for image in images
|
178 |
]
|
179 |
|
180 |
for image_path in image_paths:
|
181 |
logger.info(f"Image saved as {image_path} with metadata")
|
182 |
|
183 |
-
return image_paths,
|
184 |
except Exception as e:
|
185 |
logger.exception(f"An error occurred: {e}")
|
186 |
raise
|
|
|
107 |
|
108 |
if use_upscaler:
|
109 |
upscaler_pipe = StableDiffusionXLImg2ImgPipeline(**pipe.components)
|
110 |
+
parameters = {
|
111 |
"prompt": prompt,
|
112 |
"negative_prompt": negative_prompt,
|
113 |
"resolution": f"{width} x {height}",
|
|
|
118 |
"sdxl_style": style_selector,
|
119 |
"add_quality_tags": add_quality_tags,
|
120 |
"quality_tags": quality_selector,
|
|
|
|
|
121 |
}
|
122 |
|
123 |
if use_upscaler:
|
124 |
new_width = int(width * upscale_by)
|
125 |
new_height = int(height * upscale_by)
|
126 |
+
parameters["use_upscaler"] = {
|
127 |
"upscale_method": "nearest-exact",
|
128 |
"upscaler_strength": upscaler_strength,
|
129 |
"upscale_by": upscale_by,
|
130 |
"new_resolution": f"{new_width} x {new_height}",
|
131 |
}
|
132 |
else:
|
133 |
+
parameters["use_upscaler"] = None
|
134 |
+
parameters["Model"] = {
|
135 |
+
"Model": DESCRIPTION,
|
136 |
+
"Model hash": "e3c47aedb0",
|
137 |
+
}
|
138 |
+
|
139 |
+
logger.info(json.dumps(parameters, indent=4))
|
140 |
|
141 |
try:
|
142 |
if use_upscaler:
|
|
|
175 |
|
176 |
if images:
|
177 |
image_paths = [
|
178 |
+
utils.save_image(image, parameters, OUTPUT_DIR, IS_COLAB)
|
179 |
for image in images
|
180 |
]
|
181 |
|
182 |
for image_path in image_paths:
|
183 |
logger.info(f"Image saved as {image_path} with metadata")
|
184 |
|
185 |
+
return image_paths, parameters
|
186 |
except Exception as e:
|
187 |
logger.exception(f"An error occurred: {e}")
|
188 |
raise
|