Guy2 commited on
Commit
553acaf
·
1 Parent(s): 2407c06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -12,6 +12,7 @@ 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
  with torch.no_grad():
16
 
17
  inputs = image_processor(images=image, return_tensors='pt')
@@ -31,4 +32,5 @@ def anylize(url):
31
  json_list = json.dumps(labels)
32
  return json_list
33
 
34
- gr.Interface(fn = anylize, inputs="text", outputs=gr.JSON()).launch()
 
 
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
+ return image
16
  with torch.no_grad():
17
 
18
  inputs = image_processor(images=image, return_tensors='pt')
 
32
  json_list = json.dumps(labels)
33
  return json_list
34
 
35
+ # gr.Interface(fn = anylize, inputs="text", outputs=gr.JSON()).launch()
36
+ gr.Interface(fn = anylize, inputs="text", outputs="image".launch()