gabar92 commited on
Commit
00e9d8e
·
1 Parent(s): a9d81c5

add authentication token to app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -14,6 +14,9 @@ from utils import resize_image, make_image_square, cast_pil_image_to_torch_tenso
14
  remove_square_padding
15
 
16
 
 
 
 
17
  def die_inference(
18
  image_raw,
19
  num_of_die_iterations,
@@ -94,7 +97,13 @@ def main():
94
  ]
95
 
96
  # Load DIE model
97
- die_model = UNetDIEModel(args=args)
 
 
 
 
 
 
98
 
99
  # Partially apply the model and device arguments to die_inference
100
  partial_die_inference = partial(die_inference, device=args.device, die_model=die_model)
@@ -122,7 +131,7 @@ def parse_arguments():
122
 
123
  parser = argparse.ArgumentParser()
124
 
125
- parser.add_argument("--die_model_path", default="./2024_08_09_model_epoch_89.pt")
126
  parser.add_argument("--device", default="cpu")
127
 
128
  parser.add_argument("--example_image_path", default="./example_images")
 
14
  remove_square_padding
15
 
16
 
17
+ die_token = os.getenv("DIE_TOKEN")
18
+
19
+
20
  def die_inference(
21
  image_raw,
22
  num_of_die_iterations,
 
97
  ]
98
 
99
  # Load DIE model
100
+ die_token = os.getenv("DIE_TOKEN")
101
+ model_path = hf_hub_download(
102
+ repo_id="gabar92/DIE",
103
+ filename="2024_08_09_model_epoch_89.pt",
104
+ use_auth_token=die_token
105
+ )
106
+ die_model = UNetDIEModel(args=args, model_path=model_path)
107
 
108
  # Partially apply the model and device arguments to die_inference
109
  partial_die_inference = partial(die_inference, device=args.device, die_model=die_model)
 
131
 
132
  parser = argparse.ArgumentParser()
133
 
134
+ parser.add_argument("--die_model_path", default="/2024_08_09_model_epoch_89.pt")
135
  parser.add_argument("--device", default="cpu")
136
 
137
  parser.add_argument("--example_image_path", default="./example_images")