praeclarumjj3 commited on
Commit
decef32
1 Parent(s): 6e445f1

Add hf_hub models

Browse files
Files changed (2) hide show
  1. gradio_app.py +15 -6
  2. requirements.txt +2 -0
gradio_app.py CHANGED
@@ -25,6 +25,7 @@ from demo.defaults import DefaultPredictor
25
  from demo.visualizer import Visualizer, ColorMode
26
 
27
  import gradio as gr
 
28
 
29
  KEY_DICT = {"Cityscapes (19 classes)": "cityscapes",
30
  "COCO (133 classes)": "coco",
@@ -34,17 +35,25 @@ SWIN_CFG_DICT = {"cityscapes": "configs/cityscapes/oneformer_swin_large_IN21k_38
34
  "coco": "configs/coco/oneformer_swin_large_IN21k_384_bs16_100ep.yaml",
35
  "ade20k": "configs/ade20k/oneformer_swin_large_IN21k_384_bs16_160k.yaml",}
36
 
37
- SWIN_MODEL_DICT = {"cityscapes": "models/250_16_swin_l_oneformer_cityscapes_90k.pth",
38
- "coco": "models/150_16_swin_l_oneformer_coco_100ep.pth",
39
- "ade20k": "models/250_16_swin_l_oneformer_ade20k_160k.pth"}
 
 
 
 
40
 
41
  DINAT_CFG_DICT = {"cityscapes": "configs/cityscapes/oneformer_dinat_large_bs16_90k.yaml",
42
  "coco": "configs/coco/oneformer_dinat_large_bs16_100ep.yaml",
43
  "ade20k": "configs/ade20k/oneformer_dinat_large_IN21k_384_bs16_160k.yaml",}
44
 
45
- DINAT_MODEL_DICT = {"cityscapes": "models/250_16_dinat_l_oneformer_cityscapes_90k.pth",
46
- "coco": "models/150_16_dinat_l_oneformer_coco_100ep.pth",
47
- "ade20k": "models/250_16_dinat_l_oneformer_ade20k_160k.pth"}
 
 
 
 
48
 
49
  MODEL_DICT = {"DiNAT-L": DINAT_MODEL_DICT,
50
  "Swin-L": SWIN_MODEL_DICT }
 
25
  from demo.visualizer import Visualizer, ColorMode
26
 
27
  import gradio as gr
28
+ from huggingface_hub import hf_hub_download
29
 
30
  KEY_DICT = {"Cityscapes (19 classes)": "cityscapes",
31
  "COCO (133 classes)": "coco",
 
35
  "coco": "configs/coco/oneformer_swin_large_IN21k_384_bs16_100ep.yaml",
36
  "ade20k": "configs/ade20k/oneformer_swin_large_IN21k_384_bs16_160k.yaml",}
37
 
38
+ SWIN_MODEL_DICT = {"cityscapes": hf_hub_download(repo_id="shi-labs/swin_l_oneformer_cityscapes",
39
+ filename="250_16_swin_l_oneformer_cityscapes_90k.pth"),
40
+ "coco": hf_hub_download(repo_id="shi-labs/swin_l_oneformer_coco",
41
+ filename="150_16_swin_l_oneformer_coco_100ep.pth"),
42
+ "ade20k": hf_hub_download(repo_id="shi-labs/swin_l_oneformer_ade20k",
43
+ filename="250_16_swin_l_oneformer_ade20k_160k.pth")
44
+ }
45
 
46
  DINAT_CFG_DICT = {"cityscapes": "configs/cityscapes/oneformer_dinat_large_bs16_90k.yaml",
47
  "coco": "configs/coco/oneformer_dinat_large_bs16_100ep.yaml",
48
  "ade20k": "configs/ade20k/oneformer_dinat_large_IN21k_384_bs16_160k.yaml",}
49
 
50
+ DINAT_MODEL_DICT = {"cityscapes": hf_hub_download(repo_id="shi-labs/dinat_l_oneformer_cityscapes",
51
+ filename="250_16_dinat_l_oneformer_cityscapes_90k.pth"),
52
+ "coco": hf_hub_download(repo_id="shi-labs/dinat_l_oneformer_coco",
53
+ filename="150_16_dinat_l_oneformer_coco_100ep.pth"),
54
+ "ade20k": hf_hub_download(repo_id="shi-labs/dinat_l_oneformer_ade20k",
55
+ filename="250_16_dinat_l_oneformer_ade20k_160k.pth")
56
+ }
57
 
58
  MODEL_DICT = {"DiNAT-L": DINAT_MODEL_DICT,
59
  "Swin-L": SWIN_MODEL_DICT }
requirements.txt CHANGED
@@ -26,6 +26,8 @@ ftfy
26
  regex
27
  inflect
28
  diffdist
 
 
29
  pytorch_lightning
30
  tqdm
31
  gradio==3.1.4
 
26
  regex
27
  inflect
28
  diffdist
29
+ gdown
30
+ huggingface_hub
31
  pytorch_lightning
32
  tqdm
33
  gradio==3.1.4