apailang commited on
Commit
ad7889a
Β·
1 Parent(s): c2974a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -63,13 +63,13 @@ def predict2(image_np,Threshold):
63
  category_index,
64
  use_normalized_coordinates=True,
65
  max_boxes_to_draw=20,
66
- min_score_thresh=Threshold,#0.38,
67
  agnostic_mode=False,
68
  line_thickness=2)
69
 
70
  result_pil_img2 = tf.keras.utils.array_to_img(image_np_with_detections[0])
71
 
72
- return result_pil_img2
73
 
74
 
75
  def predict3(image_np,Threshold):
@@ -90,13 +90,13 @@ def predict3(image_np,Threshold):
90
  category_index,
91
  use_normalized_coordinates=True,
92
  max_boxes_to_draw=20,
93
- min_score_thresh=Threshold,#.38,
94
  agnostic_mode=False,
95
  line_thickness=2)
96
 
97
  result_pil_img4 = tf.keras.utils.array_to_img(image_np_with_detections[0])
98
 
99
- return result_pil_img4
100
 
101
  # def detect_video(video):
102
  # # Create a video capture object
@@ -173,7 +173,7 @@ test12 = os.path.join(os.path.dirname(__file__), "data/test12.jpeg")
173
  base_image = gr.Interface(
174
  fn=predict,
175
  # inputs=[gr.Image(type="pil"),gr.Slider(minimum=0.01, maximum=1, value=0.38 ,label="Threshold",info="[not in used]to set prediction confidence threshold")],
176
- inputs=[gr.Image(type="pil"),gr.Textbox(value=threshold_d ,label="To change default 0.38 prediction confidence Threshold",info="Select image with 0.38 threshold to start, you may amend threshold after each first image inference")],
177
 
178
  outputs=[gr.Image(type="pil",label="Base Model Inference"),gr.Image(type="pil",label="Tuned Model Inference"),gr.Textbox(label="Both images inferenced threshold")],
179
  title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",
 
63
  category_index,
64
  use_normalized_coordinates=True,
65
  max_boxes_to_draw=20,
66
+ min_score_thresh=0.38,
67
  agnostic_mode=False,
68
  line_thickness=2)
69
 
70
  result_pil_img2 = tf.keras.utils.array_to_img(image_np_with_detections[0])
71
 
72
+ return result_pil_img2,Threshold
73
 
74
 
75
  def predict3(image_np,Threshold):
 
90
  category_index,
91
  use_normalized_coordinates=True,
92
  max_boxes_to_draw=20,
93
+ min_score_thresh=.38,
94
  agnostic_mode=False,
95
  line_thickness=2)
96
 
97
  result_pil_img4 = tf.keras.utils.array_to_img(image_np_with_detections[0])
98
 
99
+ return result_pil_img4,Threshold
100
 
101
  # def detect_video(video):
102
  # # Create a video capture object
 
173
  base_image = gr.Interface(
174
  fn=predict,
175
  # inputs=[gr.Image(type="pil"),gr.Slider(minimum=0.01, maximum=1, value=0.38 ,label="Threshold",info="[not in used]to set prediction confidence threshold")],
176
+ inputs=[gr.Image(type="pil"),gr.Slider(minimum=0.01, maximum=1,value=threshold_d ,label="[WIP]To change default 0.38 prediction confidence Threshold",info="[not in used]Select image with 0.38 threshold to start, you may amend threshold after each first image inference")],
177
 
178
  outputs=[gr.Image(type="pil",label="Base Model Inference"),gr.Image(type="pil",label="Tuned Model Inference"),gr.Textbox(label="Both images inferenced threshold")],
179
  title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",