leonelhs commited on
Commit
83d740b
1 Parent(s): c03c9bc

fixing model path

Browse files
Files changed (3) hide show
  1. app.py +6 -1
  2. models/.gitkeep +0 -1
  3. models/ColorizeArtistic_gen.pth +0 -3
app.py CHANGED
@@ -1,18 +1,23 @@
1
  import os
2
  import warnings
 
3
 
4
  import gradio as gr
5
  from deoldify import device
6
  from deoldify.device_id import DeviceId
7
  from deoldify.visualize import get_image_colorizer
 
8
 
9
  os.system("pip freeze")
10
  warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")
11
 
12
  device.set(device=DeviceId.CPU)
13
 
 
 
 
14
  device.set(device=DeviceId.GPU0)
15
- colorizer = get_image_colorizer(artistic=True)
16
 
17
 
18
  def predict(image):
 
1
  import os
2
  import warnings
3
+ from pathlib import Path
4
 
5
  import gradio as gr
6
  from deoldify import device
7
  from deoldify.device_id import DeviceId
8
  from deoldify.visualize import get_image_colorizer
9
+ from huggingface_hub import snapshot_download
10
 
11
  os.system("pip freeze")
12
  warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")
13
 
14
  device.set(device=DeviceId.CPU)
15
 
16
+ REPO_ID = "leonelhs/deoldify"
17
+ snapshot_folder = snapshot_download(repo_id=REPO_ID)
18
+
19
  device.set(device=DeviceId.GPU0)
20
+ colorizer = get_image_colorizer(root_folder=Path(snapshot_folder), artistic=True)
21
 
22
 
23
  def predict(image):
models/.gitkeep DELETED
@@ -1 +0,0 @@
1
-
 
 
models/ColorizeArtistic_gen.pth DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3f750246fa220529323b85a8905f9b49c0e5d427099185334d048fb5b5e22477
3
- size 255144681