Guy2 commited on
Commit
2407c06
·
1 Parent(s): 664cf36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -12,12 +12,12 @@ model = DetrForObjectDetection.from_pretrained("Guy2/AirportSec-150epoch")
12
  id2label = {0: 'dangerous-items', 1: 'Gun', 2: 'Knife', 3: 'Pliers', 4: 'Scissors', 5: 'Wrench'}
13
  def anylize(url):
14
  image = Image.open(requests.get(url, stream=True).raw)
15
- image = np.array(image)
16
  with torch.no_grad():
17
 
18
  inputs = image_processor(images=image, return_tensors='pt')
19
  outputs = model(**inputs)
20
-
 
21
  target_sizes = torch.tensor([image.shape[:2]])
22
  results = image_processor.post_process_object_detection(
23
  outputs=outputs,
 
12
  id2label = {0: 'dangerous-items', 1: 'Gun', 2: 'Knife', 3: 'Pliers', 4: 'Scissors', 5: 'Wrench'}
13
  def anylize(url):
14
  image = Image.open(requests.get(url, stream=True).raw)
 
15
  with torch.no_grad():
16
 
17
  inputs = image_processor(images=image, return_tensors='pt')
18
  outputs = model(**inputs)
19
+
20
+ image = np.array(image)
21
  target_sizes = torch.tensor([image.shape[:2]])
22
  results = image_processor.post_process_object_detection(
23
  outputs=outputs,