Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,15 +118,15 @@ def infer(prompt_input, negative_prompt_input, seed, width, height, guidance_sca
|
|
| 118 |
consume_time_list.append(time.time() - start_time - sum(consume_time_list))
|
| 119 |
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
|
| 131 |
|
| 132 |
imagescaleby_17 = imagescaleby.upscale(
|
|
|
|
| 118 |
consume_time_list.append(time.time() - start_time - sum(consume_time_list))
|
| 119 |
|
| 120 |
|
| 121 |
+
if width <= 1024 and height <= 1024:
|
| 122 |
+
image_tensor = get_value_at_index(ksampler_efficient_23, 5)[0]
|
| 123 |
+
image_tensor = torch.clamp(image_tensor * 255.0, 0, 255) # calc to 255 on gpu
|
| 124 |
+
image_uint8 = image_tensor.cpu().numpy().astype(np.uint8)
|
| 125 |
+
# pillow_img = Image.fromarray(image_uint8)
|
| 126 |
+
consume_time_list.append(time.time() - start_time - sum(consume_time_list))
|
| 127 |
+
consume_time = time.time() - start_time
|
| 128 |
+
print(f"[{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] consume:{consume_time:.1f}s ({[f'{t:.1f}' for t in consume_time_list]})")
|
| 129 |
+
return image_uint8
|
| 130 |
|
| 131 |
|
| 132 |
imagescaleby_17 = imagescaleby.upscale(
|