Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -144,20 +144,6 @@ def get_example():
|
|
| 144 |
]
|
| 145 |
return case
|
| 146 |
|
| 147 |
-
def run_for_examples(face_file, pose_file, style, prompt, negative_prompt, ):
|
| 148 |
-
return generate_image(
|
| 149 |
-
face_file,
|
| 150 |
-
pose_file,
|
| 151 |
-
style,
|
| 152 |
-
prompt,
|
| 153 |
-
negative_prompt,
|
| 154 |
-
20, # num_steps
|
| 155 |
-
0.9, # ControlNet strength
|
| 156 |
-
0.8, # Adapter strength
|
| 157 |
-
5.0, # guidance_scale
|
| 158 |
-
42, # seed
|
| 159 |
-
1280, # max side
|
| 160 |
-
)
|
| 161 |
|
| 162 |
def convert_from_cv2_to_image(img: np.ndarray) -> Image:
|
| 163 |
return Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
|
@@ -222,6 +208,21 @@ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str
|
|
| 222 |
p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
|
| 223 |
return p.replace("{prompt}", positive), n + ' ' + negative
|
| 224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
@spaces.GPU
|
| 226 |
def generate_image(
|
| 227 |
face_image_path,
|
|
|
|
| 144 |
]
|
| 145 |
return case
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
def convert_from_cv2_to_image(img: np.ndarray) -> Image:
|
| 149 |
return Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
|
|
|
| 208 |
p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
|
| 209 |
return p.replace("{prompt}", positive), n + ' ' + negative
|
| 210 |
|
| 211 |
+
def run_for_examples(face_file, pose_file, style, prompt, negative_prompt, ):
|
| 212 |
+
return generate_image(
|
| 213 |
+
face_file,
|
| 214 |
+
pose_file,
|
| 215 |
+
style,
|
| 216 |
+
prompt,
|
| 217 |
+
negative_prompt,
|
| 218 |
+
20, # num_steps
|
| 219 |
+
0.9, # ControlNet strength
|
| 220 |
+
0.8, # Adapter strength
|
| 221 |
+
5.0, # guidance_scale
|
| 222 |
+
42, # seed
|
| 223 |
+
1280, # max side
|
| 224 |
+
)
|
| 225 |
+
|
| 226 |
@spaces.GPU
|
| 227 |
def generate_image(
|
| 228 |
face_image_path,
|