nielsr HF staff commited on
Commit
1aad1bc
1 Parent(s): 608106d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -21,6 +21,8 @@ from detectron2.utils.visualizer import ColorMode, Visualizer
21
  from detectron2.data import MetadataCatalog
22
  from detectron2.engine import DefaultPredictor
23
 
 
 
24
  import gradio as gr
25
 
26
 
@@ -30,7 +32,8 @@ add_vit_config(cfg)
30
  cfg.merge_from_file("cascade_dit_base.yml")
31
 
32
  # Step 2: add model weights URL to config
33
- cfg.MODEL.WEIGHTS = "publaynet_dit-b_cascade.pth"
 
34
 
35
  # Step 3: set device
36
  cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
 
21
  from detectron2.data import MetadataCatalog
22
  from detectron2.engine import DefaultPredictor
23
 
24
+ from huggingface_hub import hf_hub_download
25
+
26
  import gradio as gr
27
 
28
 
 
32
  cfg.merge_from_file("cascade_dit_base.yml")
33
 
34
  # Step 2: add model weights URL to config
35
+ filepath = hf_hub_download(repo_id="Sebas6k/DiT_weights", filename="publaynet_dit-b_cascade.pth", repo_type="model")
36
+ cfg.MODEL.WEIGHTS = filepath
37
 
38
  # Step 3: set device
39
  cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"