praeclarumjj3 commited on
Commit
e56ce7a
·
1 Parent(s): d57d9e6

Fix model load

Browse files
Files changed (1) hide show
  1. gradio_app.py +8 -8
gradio_app.py CHANGED
@@ -77,11 +77,11 @@ PREDICTORS = {
77
  }
78
  }
79
 
80
- def setup_predictors():
81
- for dataset in ["Cityscapes (19 classes)", "COCO (133 classes)", "ADE20K (150 classes)"]:
82
- for backbone in ["DiNAT-L", "Swin-L"]:
83
- cfg = setup_cfg(dataset, backbone)
84
- PREDICTORS[backbone][dataset] = DefaultPredictor(cfg)
85
 
86
  def setup_cfg(dataset, backbone):
87
  # load config from file and command-line arguments
@@ -104,8 +104,8 @@ def setup_cfg(dataset, backbone):
104
 
105
  def setup_modules(dataset, backbone):
106
  cfg = setup_cfg(dataset, backbone)
107
- # predictor = DefaultPredictor(cfg)
108
- predictor = PREDICTORS[backbone][dataset]
109
  metadata = MetadataCatalog.get(
110
  cfg.DATASETS.TEST_PANOPTIC[0] if len(cfg.DATASETS.TEST_PANOPTIC) else "__unused"
111
  )
@@ -175,7 +175,7 @@ description = "<p style='color: #E0B941; font-size: 16px; font-weight: w600; tex
175
 
176
  # css = ".image-preview {height: 32rem; width: auto;} .output-image {height: 32rem; width: auto;} .panel-buttons { display: flex; flex-direction: row;}"
177
 
178
- setup_predictors()
179
 
180
  gradio_inputs = [gr.Image(source="upload", tool=None, label="Input Image",type="filepath"),
181
  gr.inputs.Radio(choices=["the task is panoptic" ,"the task is instance", "the task is semantic"], type="value", default="the task is panoptic", label="Task Token Input"),
 
77
  }
78
  }
79
 
80
+ # def setup_predictors():
81
+ # for dataset in ["Cityscapes (19 classes)", "COCO (133 classes)", "ADE20K (150 classes)"]:
82
+ # for backbone in ["DiNAT-L", "Swin-L"]:
83
+ # cfg = setup_cfg(dataset, backbone)
84
+ # PREDICTORS[backbone][dataset] = DefaultPredictor(cfg)
85
 
86
  def setup_cfg(dataset, backbone):
87
  # load config from file and command-line arguments
 
104
 
105
  def setup_modules(dataset, backbone):
106
  cfg = setup_cfg(dataset, backbone)
107
+ predictor = DefaultPredictor(cfg)
108
+ # predictor = PREDICTORS[backbone][dataset]
109
  metadata = MetadataCatalog.get(
110
  cfg.DATASETS.TEST_PANOPTIC[0] if len(cfg.DATASETS.TEST_PANOPTIC) else "__unused"
111
  )
 
175
 
176
  # css = ".image-preview {height: 32rem; width: auto;} .output-image {height: 32rem; width: auto;} .panel-buttons { display: flex; flex-direction: row;}"
177
 
178
+ # setup_predictors()
179
 
180
  gradio_inputs = [gr.Image(source="upload", tool=None, label="Input Image",type="filepath"),
181
  gr.inputs.Radio(choices=["the task is panoptic" ,"the task is instance", "the task is semantic"], type="value", default="the task is panoptic", label="Task Token Input"),