Gabolozano commited on
Commit
68f583c
·
verified ·
1 Parent(s): 793cc29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -6,15 +6,15 @@ import cv2
6
  from PIL import Image
7
 
8
  # Pre-load the base configuration and models (without setting a threshold yet)
9
- base_config = DetrConfig.from_pretrained("facebook/detr-resnet-50")
10
- base_model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50", config=base_config)
11
- base_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")
12
 
13
  def load_model(threshold):
14
  # Adjust the configuration for the current threshold
15
  config = DetrConfig.from_pretrained("facebook/detr-resnet-50", threshold=threshold)
16
  # Create a new model instance with the updated configuration
17
- model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50", config=config)
18
  # Image processor does not need to be re-loaded
19
  return pipeline(task='object-detection', model=model, image_processor=base_processor)
20
 
 
6
  from PIL import Image
7
 
8
  # Pre-load the base configuration and models (without setting a threshold yet)
9
+ base_config = DetrConfig.from_pretrained("facebook/detr-resnet-101")
10
+ base_model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-101", config=base_config)
11
+ base_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-101")
12
 
13
  def load_model(threshold):
14
  # Adjust the configuration for the current threshold
15
  config = DetrConfig.from_pretrained("facebook/detr-resnet-50", threshold=threshold)
16
  # Create a new model instance with the updated configuration
17
+ model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-101", config=config)
18
  # Image processor does not need to be re-loaded
19
  return pipeline(task='object-detection', model=model, image_processor=base_processor)
20