AnishaNaik03 commited on
Commit
8ea3803
·
verified ·
1 Parent(s): b1fbe33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -9,19 +9,19 @@ from detectron2.config import get_cfg
9
  from detectron2 import model_zoo
10
  import torch_utils
11
  import dnnlib
12
- # Create output directory if it doesn't exist
13
- # output_dir = "key/"
14
- # os.makedirs(output_dir, exist_ok=True)
15
- # output_file = os.path.join(output_dir, "keypoints.json")
16
-
17
- # # Load pre-trained Keypoint R-CNN model
18
- # cfg = get_cfg()
19
- # cfg.merge_from_file(model_zoo.get_config_file("COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml"))
20
- # cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml")
21
- # cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
22
-
23
- # # Load the predictor
24
- # predictor = DefaultPredictor(cfg)
25
 
26
  def process_image(image, user_height_cm):
27
  # Convert Gradio image input to OpenCV format
 
9
  from detectron2 import model_zoo
10
  import torch_utils
11
  import dnnlib
12
+ Create output directory if it doesn't exist
13
+ output_dir = "key/"
14
+ os.makedirs(output_dir, exist_ok=True)
15
+ output_file = os.path.join(output_dir, "keypoints.json")
16
+
17
+ # Load pre-trained Keypoint R-CNN model
18
+ cfg = get_cfg()
19
+ cfg.merge_from_file(model_zoo.get_config_file("COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml"))
20
+ cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml")
21
+ cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
22
+
23
+ # Load the predictor
24
+ predictor = DefaultPredictor(cfg)
25
 
26
  def process_image(image, user_height_cm):
27
  # Convert Gradio image input to OpenCV format