fix error bug
Browse files
app.py
CHANGED
|
@@ -110,6 +110,9 @@ def load_data(file_path) -> np.ndarray:
|
|
| 110 |
|
| 111 |
def display_crop(data, x_offset, y_offset, auto_contrast) -> Image:
|
| 112 |
|
|
|
|
|
|
|
|
|
|
| 113 |
crop = data[y_offset:y_offset + 1024, x_offset:x_offset + 1024]
|
| 114 |
original_image_normalized = Auto_contrast(crop) if auto_contrast else (crop - crop.min()) / (crop.max() - crop.min())
|
| 115 |
input_image = Image.fromarray((original_image_normalized * 255).astype(np.uint8))
|
|
@@ -119,6 +122,9 @@ def display_crop(data, x_offset, y_offset, auto_contrast) -> Image:
|
|
| 119 |
@spaces.GPU
|
| 120 |
def process_and_denoise(data, x_offset, y_offset, auto_contrast) -> Image:
|
| 121 |
|
|
|
|
|
|
|
|
|
|
| 122 |
crop = data[y_offset:y_offset + 1024, x_offset:x_offset + 1024]
|
| 123 |
denoised_data = denoiser.inference(Image.fromarray(crop))
|
| 124 |
|
|
|
|
| 110 |
|
| 111 |
def display_crop(data, x_offset, y_offset, auto_contrast) -> Image:
|
| 112 |
|
| 113 |
+
if data is None:
|
| 114 |
+
return None
|
| 115 |
+
|
| 116 |
crop = data[y_offset:y_offset + 1024, x_offset:x_offset + 1024]
|
| 117 |
original_image_normalized = Auto_contrast(crop) if auto_contrast else (crop - crop.min()) / (crop.max() - crop.min())
|
| 118 |
input_image = Image.fromarray((original_image_normalized * 255).astype(np.uint8))
|
|
|
|
| 122 |
@spaces.GPU
|
| 123 |
def process_and_denoise(data, x_offset, y_offset, auto_contrast) -> Image:
|
| 124 |
|
| 125 |
+
if data is None:
|
| 126 |
+
return None
|
| 127 |
+
|
| 128 |
crop = data[y_offset:y_offset + 1024, x_offset:x_offset + 1024]
|
| 129 |
denoised_data = denoiser.inference(Image.fromarray(crop))
|
| 130 |
|