Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -285,7 +285,6 @@ def preprocess_image(models, input_im, preprocess):
|
|
| 285 |
start_time = time.time()
|
| 286 |
|
| 287 |
if preprocess:
|
| 288 |
-
input_im.thumbnail([1536, 1536], Image.Resampling.LANCZOS)
|
| 289 |
input_im = load_and_preprocess(models['carvekit'], input_im)
|
| 290 |
input_im = (input_im / 255.0).astype(np.float32)
|
| 291 |
# (H, W, 3) array in [0, 1].
|
|
@@ -322,6 +321,7 @@ def main_run(models, device, cam_vis, return_what,
|
|
| 322 |
:param raw_im (PIL Image).
|
| 323 |
'''
|
| 324 |
|
|
|
|
| 325 |
safety_checker_input = models['clip_fe'](raw_im, return_tensors='pt').to(device)
|
| 326 |
(image, has_nsfw_concept) = models['nsfw'](
|
| 327 |
images=np.ones((1, 3)), clip_input=safety_checker_input.pixel_values)
|
|
|
|
| 285 |
start_time = time.time()
|
| 286 |
|
| 287 |
if preprocess:
|
|
|
|
| 288 |
input_im = load_and_preprocess(models['carvekit'], input_im)
|
| 289 |
input_im = (input_im / 255.0).astype(np.float32)
|
| 290 |
# (H, W, 3) array in [0, 1].
|
|
|
|
| 321 |
:param raw_im (PIL Image).
|
| 322 |
'''
|
| 323 |
|
| 324 |
+
raw_im.thumbnail([1536, 1536], Image.Resampling.LANCZOS)
|
| 325 |
safety_checker_input = models['clip_fe'](raw_im, return_tensors='pt').to(device)
|
| 326 |
(image, has_nsfw_concept) = models['nsfw'](
|
| 327 |
images=np.ones((1, 3)), clip_input=safety_checker_input.pixel_values)
|