akhaliq HF staff commited on
Commit
8ceafbd
1 Parent(s): 08e68b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -23,8 +23,7 @@ os.system("wget https://github.com/AK391/models/raw/main/vision/object_detection
23
  sess = rt.InferenceSession("fcn-resnet101-11.onnx")
24
 
25
  outputs = sess.get_outputs()
26
- output_names = list(map(lambda output: output.name, outputs))
27
- input_name = sess.get_inputs()[0].name
28
 
29
  classes = [line.rstrip('\n') for line in open('voc_classes.txt')]
30
  num_classes = len(classes)
@@ -78,10 +77,13 @@ def inference(img):
78
  input_tensor = preprocess(input_image)
79
  input_tensor = input_tensor.unsqueeze(0)
80
  input_tensor = input_tensor.detach().cpu().numpy()
81
-
 
82
  detections = sess.run(output_names, {input_name: input_tensor})
83
  output, aux = detections
84
  conf, result_img, blended_img, _ = visualize_output(orig_tensor, output[0])
85
  return blended_img
86
 
87
- gr.Interface(inference,gr.inputs.Image(type="filepath"),gr.outputs.Image(type="pil")).launch(enable_queue=True)
 
 
 
23
  sess = rt.InferenceSession("fcn-resnet101-11.onnx")
24
 
25
  outputs = sess.get_outputs()
26
+
 
27
 
28
  classes = [line.rstrip('\n') for line in open('voc_classes.txt')]
29
  num_classes = len(classes)
 
77
  input_tensor = preprocess(input_image)
78
  input_tensor = input_tensor.unsqueeze(0)
79
  input_tensor = input_tensor.detach().cpu().numpy()
80
+ output_names = list(map(lambda output: output.name, outputs))
81
+ input_name = sess.get_inputs()[0].name
82
  detections = sess.run(output_names, {input_name: input_tensor})
83
  output, aux = detections
84
  conf, result_img, blended_img, _ = visualize_output(orig_tensor, output[0])
85
  return blended_img
86
 
87
+ title="Fully Convolutional Network"
88
+ description="FCNs are a model for real-time neural network for class-wise image segmentation. As the name implies, every weight layer in the network is convolutional. The final layer has the same height/width as the input image, making FCNs a useful tool for doing dense pixel-wise predictions without a significant amount of postprocessing. Being fully convolutional also provides great flexibility in the resolutions this model can handle. This specific model detects 20 different classes. The models have been pre-trained on the COCO train2017 dataset on this class subset."
89
+ gr.Interface(inference,gr.inputs.Image(type="filepath"),gr.outputs.Image(type="pil"),title=title,description=description).launch(enable_queue=True)