Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,9 @@ def anylize(img):
|
|
8 |
id2label = {0: 'dangerous-items', 1: 'Gun', 2: 'Knife', 3: 'Pliers', 4: 'Scissors', 5: 'Wrench'}
|
9 |
image = img
|
10 |
|
|
|
|
|
|
|
11 |
with torch.no_grad():
|
12 |
|
13 |
inputs = image_processor(images=image, return_tensors='pt')
|
@@ -26,5 +29,4 @@ def anylize(img):
|
|
26 |
json_list = json.dumps(str(labels[0]))
|
27 |
return json_list
|
28 |
|
29 |
-
gr.Interface(fn = anylize, inputs="image", outputs=gr.JSON()).launch()
|
30 |
-
gr.Interface.load("models/Guy2/AirportSec-100epoch").launch()
|
|
|
8 |
id2label = {0: 'dangerous-items', 1: 'Gun', 2: 'Knife', 3: 'Pliers', 4: 'Scissors', 5: 'Wrench'}
|
9 |
image = img
|
10 |
|
11 |
+
processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")
|
12 |
+
model = DetrForObjectDetection.from_pretrained("Guy2/AirportSec-100epoch")
|
13 |
+
|
14 |
with torch.no_grad():
|
15 |
|
16 |
inputs = image_processor(images=image, return_tensors='pt')
|
|
|
29 |
json_list = json.dumps(str(labels[0]))
|
30 |
return json_list
|
31 |
|
32 |
+
gr.Interface(fn = anylize, inputs="image", outputs=gr.JSON()).launch()
|
|