Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -175,18 +175,18 @@ tag_model.to(device, dtype=weight_dtype)
|
|
| 175 |
@spaces.GPU()
|
| 176 |
def process(
|
| 177 |
input_image: Image.Image,
|
| 178 |
-
user_prompt
|
| 179 |
-
num_inference_steps: int,
|
| 180 |
-
scale_factor: int,
|
| 181 |
-
cfg_scale: float,
|
| 182 |
-
seed: int,
|
| 183 |
-
latent_tiled_size: int,
|
| 184 |
-
latent_tiled_overlap: int,
|
| 185 |
-
sample_times: int
|
| 186 |
-
) -> List[np.ndarray]:
|
| 187 |
positive_prompt = "clean, high-resolution, 8k, best quality, masterpiece",
|
| 188 |
negative_prompt = "dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
resize_preproc = transforms.Compose([
|
| 191 |
transforms.Resize(process_size, interpolation=transforms.InterpolationMode.BILINEAR),
|
| 192 |
])
|
|
@@ -289,37 +289,13 @@ with block:
|
|
| 289 |
examples=[
|
| 290 |
[
|
| 291 |
"preset/datasets/test_datasets/179.png",
|
| 292 |
-
"",
|
| 293 |
-
50,
|
| 294 |
-
4,
|
| 295 |
-
7.5,
|
| 296 |
-
123,
|
| 297 |
-
320,
|
| 298 |
-
4,
|
| 299 |
-
1,
|
| 300 |
],
|
| 301 |
[
|
| 302 |
"preset/datasets/test_datasets/apologise.png",
|
| 303 |
-
"",
|
| 304 |
-
50,
|
| 305 |
-
4,
|
| 306 |
-
7.5,
|
| 307 |
-
123,
|
| 308 |
-
320,
|
| 309 |
-
4,
|
| 310 |
-
1,
|
| 311 |
],
|
| 312 |
],
|
| 313 |
inputs=[
|
| 314 |
input_image,
|
| 315 |
-
user_prompt,
|
| 316 |
-
num_inference_steps,
|
| 317 |
-
scale_factor,
|
| 318 |
-
cfg_scale,
|
| 319 |
-
seed,
|
| 320 |
-
latent_tiled_size,
|
| 321 |
-
latent_tiled_overlap,
|
| 322 |
-
sample_times,
|
| 323 |
],
|
| 324 |
outputs=[result_gallery],
|
| 325 |
fn=process,
|
|
@@ -327,14 +303,6 @@ with block:
|
|
| 327 |
)
|
| 328 |
inputs = [
|
| 329 |
input_image,
|
| 330 |
-
user_prompt,
|
| 331 |
-
num_inference_steps,
|
| 332 |
-
scale_factor,
|
| 333 |
-
cfg_scale,
|
| 334 |
-
seed,
|
| 335 |
-
latent_tiled_size,
|
| 336 |
-
latent_tiled_overlap,
|
| 337 |
-
sample_times,
|
| 338 |
]
|
| 339 |
run_button.click(fn=process, inputs=inputs, outputs=[result_gallery])
|
| 340 |
|
|
|
|
| 175 |
@spaces.GPU()
|
| 176 |
def process(
|
| 177 |
input_image: Image.Image,
|
| 178 |
+
user_prompt = "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
positive_prompt = "clean, high-resolution, 8k, best quality, masterpiece",
|
| 180 |
negative_prompt = "dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
| 181 |
+
num_inference_steps = 50,
|
| 182 |
+
scale_factor = 4,
|
| 183 |
+
cfg_scale = 7.5,
|
| 184 |
+
seed = 123,
|
| 185 |
+
latent_tiled_size = 320,
|
| 186 |
+
latent_tiled_overlap = 4,
|
| 187 |
+
sample_times = 1,
|
| 188 |
+
) -> List[np.ndarray]:
|
| 189 |
+
process_size = 512
|
| 190 |
resize_preproc = transforms.Compose([
|
| 191 |
transforms.Resize(process_size, interpolation=transforms.InterpolationMode.BILINEAR),
|
| 192 |
])
|
|
|
|
| 289 |
examples=[
|
| 290 |
[
|
| 291 |
"preset/datasets/test_datasets/179.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
],
|
| 293 |
[
|
| 294 |
"preset/datasets/test_datasets/apologise.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
],
|
| 296 |
],
|
| 297 |
inputs=[
|
| 298 |
input_image,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
],
|
| 300 |
outputs=[result_gallery],
|
| 301 |
fn=process,
|
|
|
|
| 303 |
)
|
| 304 |
inputs = [
|
| 305 |
input_image,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
]
|
| 307 |
run_button.click(fn=process, inputs=inputs, outputs=[result_gallery])
|
| 308 |
|