cleanup
Browse files
app.py
CHANGED
@@ -11,7 +11,6 @@ import fastai
|
|
11 |
from deoldify import device
|
12 |
from deoldify.device_id import DeviceId
|
13 |
from deoldify.visualize import *
|
14 |
-
# from huggingface_hub import HfApi, snapshot_download
|
15 |
from huggingface_hub import HfApi, HfFolder
|
16 |
|
17 |
os.system("pip freeze")
|
@@ -19,19 +18,14 @@ from collections.abc import Sized # Import Sized from collections.abc
|
|
19 |
# Suppress warnings
|
20 |
warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")
|
21 |
|
22 |
-
# Private repo settings
|
23 |
-
token = os.getenv("HF_TOKEN")
|
24 |
repo_id = "afondiel/image-colorizer-deoldify"
|
25 |
repo_type = "space"
|
26 |
|
27 |
-
#
|
28 |
device.set(device=DeviceId.CPU)
|
29 |
|
30 |
# Initialize Hugging Face API
|
31 |
-
api = HfApi(
|
32 |
-
|
33 |
-
# Authenticate
|
34 |
-
HfFolder.save_token(token)
|
35 |
|
36 |
# Download the snapshot from the space repository
|
37 |
snapshot_folder = api.snapshot_download(repo_id=repo_id, repo_type=repo_type)
|
|
|
11 |
from deoldify import device
|
12 |
from deoldify.device_id import DeviceId
|
13 |
from deoldify.visualize import *
|
|
|
14 |
from huggingface_hub import HfApi, HfFolder
|
15 |
|
16 |
os.system("pip freeze")
|
|
|
18 |
# Suppress warnings
|
19 |
warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")
|
20 |
|
|
|
|
|
21 |
repo_id = "afondiel/image-colorizer-deoldify"
|
22 |
repo_type = "space"
|
23 |
|
24 |
+
# run on CPU
|
25 |
device.set(device=DeviceId.CPU)
|
26 |
|
27 |
# Initialize Hugging Face API
|
28 |
+
api = HfApi()
|
|
|
|
|
|
|
29 |
|
30 |
# Download the snapshot from the space repository
|
31 |
snapshot_folder = api.snapshot_download(repo_id=repo_id, repo_type=repo_type)
|