wufan commited on
Commit
9eb5356
1 Parent(s): 61d07b2

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -9,6 +9,18 @@ import numpy as np
9
  from PIL import Image
10
  from huggingface_hub import snapshot_download
11
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  sys.path.insert(0, os.path.join(os.getcwd(), ".."))
13
  from unimernet.common.config import Config
14
  import unimernet.tasks as tasks
@@ -47,18 +59,6 @@ def gradio_reset():
47
 
48
  if __name__ == "__main__":
49
  root_path = os.path.abspath(os.getcwd())
50
-
51
- # == download weights ==
52
- tiny_model_dir = snapshot_download('wanderkid/unimernet_tiny')
53
- small_model_dir = snapshot_download('wanderkid/unimernet_small')
54
- base_model_dir = snapshot_download('wanderkid/unimernet_base')
55
-
56
- os.makedirs(os.path.join(root_path, "models"), exist_ok=True)
57
- shutil.move(tiny_model_dir, os.path.join(root_path, "models", "unimernet_tiny"))
58
- shutil.move(small_model_dir, os.path.join(root_path, "models", "unimernet_small"))
59
- shutil.move(base_model_dir, os.path.join(root_path, "models", "unimernet_base"))
60
- # == download weights ==
61
-
62
  # == load model ==
63
  model_tiny, vis_processor = load_model_and_processor(os.path.join(root_path, "cfg_tiny.yaml"))
64
  model_small, vis_processor = load_model_and_processor(os.path.join(root_path, "cfg_small.yaml"))
 
9
  from PIL import Image
10
  from huggingface_hub import snapshot_download
11
 
12
+ # == download weights ==
13
+ tiny_model_dir = snapshot_download('wanderkid/unimernet_tiny')
14
+ small_model_dir = snapshot_download('wanderkid/unimernet_small')
15
+ base_model_dir = snapshot_download('wanderkid/unimernet_base')
16
+
17
+ root_path = os.path.abspath(os.getcwd())
18
+ os.makedirs(os.path.join(root_path, "models"), exist_ok=True)
19
+ shutil.move(tiny_model_dir, os.path.join(root_path, "models", "unimernet_tiny"))
20
+ shutil.move(small_model_dir, os.path.join(root_path, "models", "unimernet_small"))
21
+ shutil.move(base_model_dir, os.path.join(root_path, "models", "unimernet_base"))
22
+ # == download weights ==
23
+
24
  sys.path.insert(0, os.path.join(os.getcwd(), ".."))
25
  from unimernet.common.config import Config
26
  import unimernet.tasks as tasks
 
59
 
60
  if __name__ == "__main__":
61
  root_path = os.path.abspath(os.getcwd())
 
 
 
 
 
 
 
 
 
 
 
 
62
  # == load model ==
63
  model_tiny, vis_processor = load_model_and_processor(os.path.join(root_path, "cfg_tiny.yaml"))
64
  model_small, vis_processor = load_model_and_processor(os.path.join(root_path, "cfg_small.yaml"))