clementchadebec commited on
Commit
4f9fb0d
·
verified ·
1 Parent(s): 17d0e49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import glob
 
2
  from copy import deepcopy
3
 
4
  import gradio as gr
@@ -15,6 +16,8 @@ from torchvision.transforms import ToPILImage, ToTensor
15
  from transformers import AutoModelForImageSegmentation
16
  from utils import extract_object, get_model_from_config, resize_and_center_crop
17
 
 
 
18
  ASPECT_RATIOS = {
19
  str(512 / 2048): (512, 2048),
20
  str(1024 / 1024): (1024, 1024),
@@ -30,8 +33,8 @@ ASPECT_RATIOS = {
30
  }
31
 
32
  # download the config and model
33
- MODEL_PATH = hf_hub_download("jasperai/LBM_relighting", "relight.safetensors")
34
- CONFIG_PATH = hf_hub_download("jasperai/LBM_relighting", "relight.yaml")
35
 
36
  with open(CONFIG_PATH, "r") as f:
37
  config = yaml.safe_load(f)
 
1
  import glob
2
+ import os
3
  from copy import deepcopy
4
 
5
  import gradio as gr
 
16
  from transformers import AutoModelForImageSegmentation
17
  from utils import extract_object, get_model_from_config, resize_and_center_crop
18
 
19
+ huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
20
+
21
  ASPECT_RATIOS = {
22
  str(512 / 2048): (512, 2048),
23
  str(1024 / 1024): (1024, 1024),
 
33
  }
34
 
35
  # download the config and model
36
+ MODEL_PATH = hf_hub_download("jasperai/LBM_relighting", "relight.safetensors", token=huggingface_token)
37
+ CONFIG_PATH = hf_hub_download("jasperai/LBM_relighting", "relight.yaml", token=huggingface_token)
38
 
39
  with open(CONFIG_PATH, "r") as f:
40
  config = yaml.safe_load(f)