update model path
Browse files
app.py
CHANGED
@@ -18,10 +18,8 @@ from collections.abc import Sized # Import Sized from collections.abc
|
|
18 |
warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")
|
19 |
|
20 |
|
21 |
-
|
22 |
# private repo
|
23 |
-
|
24 |
-
token = os.getenv('HUGGINGFACE_TOKEN')
|
25 |
snapshot_folder = snapshot_download(repo_id="afondiel/image-colorizer-deoldify", token=token)
|
26 |
|
27 |
# Set the device to use for computation
|
@@ -32,7 +30,7 @@ else:
|
|
32 |
device.set(device=DeviceId.CPU)
|
33 |
|
34 |
# Load the pre-trained model
|
35 |
-
|
36 |
|
37 |
|
38 |
def colorizer_fn(input_img, render_factor):
|
@@ -42,7 +40,7 @@ def colorizer_fn(input_img, render_factor):
|
|
42 |
- @param render_factor render_factor
|
43 |
"""
|
44 |
if input_img is not None and input_img !='':
|
45 |
-
output_img =
|
46 |
path=input_img,
|
47 |
render_factor=int(render_factor),
|
48 |
watermarked=watermarked,
|
|
|
18 |
warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")
|
19 |
|
20 |
|
|
|
21 |
# private repo
|
22 |
+
token = colorizer
|
|
|
23 |
snapshot_folder = snapshot_download(repo_id="afondiel/image-colorizer-deoldify", token=token)
|
24 |
|
25 |
# Set the device to use for computation
|
|
|
30 |
device.set(device=DeviceId.CPU)
|
31 |
|
32 |
# Load the pre-trained model
|
33 |
+
_colorizer = get_image_colorizer(root_folder=Path(snapshot_folder), artistic=True)
|
34 |
|
35 |
|
36 |
def colorizer_fn(input_img, render_factor):
|
|
|
40 |
- @param render_factor render_factor
|
41 |
"""
|
42 |
if input_img is not None and input_img !='':
|
43 |
+
output_img = _colorizer.get_transformed_image(
|
44 |
path=input_img,
|
45 |
render_factor=int(render_factor),
|
46 |
watermarked=watermarked,
|