Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,7 +105,7 @@ def add_gaussian_noise(image, mean=0, sigma=10):
|
|
| 105 |
noisy_image = convert_from_cv2_to_image(np.clip(image.astype(np.float32) + noise, 0, 255).astype(np.uint8))
|
| 106 |
return noisy_image
|
| 107 |
|
| 108 |
-
def tile(input_image, resolution=
|
| 109 |
input_image = convert_from_image_to_cv2(input_image)
|
| 110 |
H, W, C = input_image.shape
|
| 111 |
H = float(H)
|
|
@@ -119,7 +119,7 @@ def tile(input_image, resolution=1024):
|
|
| 119 |
img = convert_from_cv2_to_image(img)
|
| 120 |
return img
|
| 121 |
|
| 122 |
-
def resize_img(input_image, max_side=
|
| 123 |
pad_to_max_side=False, mode=Image.BILINEAR, base_pixel_number=64):
|
| 124 |
|
| 125 |
w, h = input_image.size
|
|
@@ -142,7 +142,7 @@ def resize_img(input_image, max_side=1024, min_side=768, size=None,
|
|
| 142 |
input_image = Image.fromarray(res)
|
| 143 |
return input_image
|
| 144 |
|
| 145 |
-
@spaces.GPU(duration=
|
| 146 |
def infer(cond_in, image_in, prompt, inference_steps, guidance_scale, control_mode, control_strength, seed, progress=gr.Progress(track_tqdm=True)):
|
| 147 |
|
| 148 |
control_mode_num = mode_mapping[control_mode]
|
|
|
|
| 105 |
noisy_image = convert_from_cv2_to_image(np.clip(image.astype(np.float32) + noise, 0, 255).astype(np.uint8))
|
| 106 |
return noisy_image
|
| 107 |
|
| 108 |
+
def tile(input_image, resolution=768):
|
| 109 |
input_image = convert_from_image_to_cv2(input_image)
|
| 110 |
H, W, C = input_image.shape
|
| 111 |
H = float(H)
|
|
|
|
| 119 |
img = convert_from_cv2_to_image(img)
|
| 120 |
return img
|
| 121 |
|
| 122 |
+
def resize_img(input_image, max_side=768, min_side=512, size=None,
|
| 123 |
pad_to_max_side=False, mode=Image.BILINEAR, base_pixel_number=64):
|
| 124 |
|
| 125 |
w, h = input_image.size
|
|
|
|
| 142 |
input_image = Image.fromarray(res)
|
| 143 |
return input_image
|
| 144 |
|
| 145 |
+
@spaces.GPU(duration=180)
|
| 146 |
def infer(cond_in, image_in, prompt, inference_steps, guidance_scale, control_mode, control_strength, seed, progress=gr.Progress(track_tqdm=True)):
|
| 147 |
|
| 148 |
control_mode_num = mode_mapping[control_mode]
|