afondiel commited on
Commit
fb7ce20
1 Parent(s): 0e8d222

Add ColorizeArtistic_gen.pth model

Browse files
Files changed (2) hide show
  1. app.py +6 -4
  2. models/ColorizeArtistic_gen.pth +3 -0
app.py CHANGED
@@ -24,22 +24,24 @@ token = os.getenv("HF_TOKEN")
24
  repo_id = "afondiel/image-colorizer-deoldify"
25
  repo_type = "space"
26
 
 
27
  device.set(device=DeviceId.CPU)
28
 
29
  # Initialize Hugging Face API
30
  api = HfApi(token=token)
31
 
 
32
  HfFolder.save_token(token)
33
 
34
  # Download the snapshot from the space repository
35
- snapshot_folder = api.snapshot_download(repo_id=repo_id, repo_type=repo_type, revision="main", token=token)
36
 
 
37
  device.set(device=DeviceId.GPU0)
 
38
  # Load the pre-trained model
39
  _colorizer = get_image_colorizer(root_folder=Path(snapshot_folder), artistic=True)
40
 
41
- print(f"root_folder: {root_folder}")
42
-
43
  def colorizer_fn(input_img, render_factor):
44
  """
45
  Colorize grayscale images/photos
@@ -73,4 +75,4 @@ demo = gr.Interface(
73
 
74
  # Launch the demo
75
  if __name__ == "__main__":
76
- demo.launch()
 
24
  repo_id = "afondiel/image-colorizer-deoldify"
25
  repo_type = "space"
26
 
27
+ # running primarly on CPU
28
  device.set(device=DeviceId.CPU)
29
 
30
  # Initialize Hugging Face API
31
  api = HfApi(token=token)
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)
38
 
39
+ # if GPU available
40
  device.set(device=DeviceId.GPU0)
41
+
42
  # Load the pre-trained model
43
  _colorizer = get_image_colorizer(root_folder=Path(snapshot_folder), artistic=True)
44
 
 
 
45
  def colorizer_fn(input_img, render_factor):
46
  """
47
  Colorize grayscale images/photos
 
75
 
76
  # Launch the demo
77
  if __name__ == "__main__":
78
+ demo.launch()
models/ColorizeArtistic_gen.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f750246fa220529323b85a8905f9b49c0e5d427099185334d048fb5b5e22477
3
+ size 255144681