Gabolozano commited on
Commit
648d371
·
verified ·
1 Parent(s): cfd90f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -5,6 +5,14 @@ import numpy as np
5
  import cv2
6
  from PIL import Image
7
 
 
 
 
 
 
 
 
 
8
  def draw_detections(image, detections):
9
  # Convert PIL image to a numpy array
10
  np_image = np.array(image)
 
5
  import cv2
6
  from PIL import Image
7
 
8
+ # Initialize the model
9
+ config = DetrConfig.from_pretrained("facebook/detr-resnet-50")
10
+ model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50", config=config)
11
+ image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")
12
+
13
+ # Initialize the pipeline
14
+ od_pipe = pipeline(task='object-detection', model=model, image_processor=image_processor)
15
+
16
  def draw_detections(image, detections):
17
  # Convert PIL image to a numpy array
18
  np_image = np.array(image)