Guy2 commited on
Commit
e365c96
1 Parent(s): e11d9a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -5,13 +5,14 @@ import supervision as sv
5
  import json
6
  import requests
7
  from PIL import Image
8
-
 
9
  image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")
10
  model = DetrForObjectDetection.from_pretrained("Guy2/AirportSec-150epoch")
11
  id2label = {0: 'dangerous-items', 1: 'Gun', 2: 'Knife', 3: 'Pliers', 4: 'Scissors', 5: 'Wrench'}
12
  def anylize(url):
13
  image = Image.open(requests.get(url, stream=True).raw)
14
-
15
  with torch.no_grad():
16
 
17
  inputs = image_processor(images=image, return_tensors='pt')
 
5
  import json
6
  import requests
7
  from PIL import Image
8
+ import numpy as np
9
+
10
  image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")
11
  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')