apailang commited on
Commit
0b65e94
Β·
1 Parent(s): 8f5b2b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -37,13 +37,12 @@ def load_model(model_repo_id):
37
  return detection_model
38
 
39
 
40
- def predict(pilimg,threshold):
41
 
42
  image_np = pil_image_as_numpy_array(pilimg)
43
- # threshold1=threshold
44
- # return predict2(image_np,threshold)
45
 
46
- # def predict2(image_np,threshold):
47
 
48
  results = detection_model(image_np)
49
 
@@ -61,7 +60,7 @@ def predict(pilimg,threshold):
61
  category_index,
62
  use_normalized_coordinates=True,
63
  max_boxes_to_draw=20,
64
- min_score_thresh=threshold.astype(float),
65
  agnostic_mode=False,
66
  line_thickness=2)
67
 
@@ -173,7 +172,7 @@ test12 = os.path.join(os.path.dirname(__file__), "data/test12.jpeg")
173
 
174
  base_image = gr.Interface(
175
  fn=predict,
176
- inputs=[gr.Image(type="pil"),gr.Slider(minimum=0.01, maximum=0.99, value=0.5, step=0.05 ,label="Threshold",info="to set prediction confidence threshold")],
177
  outputs=gr.Image(type="pil"),
178
  title="Luffy and Chopper face detection (Base mobile net model)",
179
  description="Upload a Image for prediction or click on below examples",
 
37
  return detection_model
38
 
39
 
40
+ def predict(pilimg):
41
 
42
  image_np = pil_image_as_numpy_array(pilimg)
43
+ return predict2(image_np)
 
44
 
45
+ def predict2(image_np):
46
 
47
  results = detection_model(image_np)
48
 
 
60
  category_index,
61
  use_normalized_coordinates=True,
62
  max_boxes_to_draw=20,
63
+ min_score_thresh=0.6),
64
  agnostic_mode=False,
65
  line_thickness=2)
66
 
 
172
 
173
  base_image = gr.Interface(
174
  fn=predict,
175
+ inputs=[gr.Image(type="pil"),gr.Slider(minimum=0.01, maximum=0.99, value=0.6 ,label="Threshold(WIP)",info="[not in used]to set prediction confidence threshold")],
176
  outputs=gr.Image(type="pil"),
177
  title="Luffy and Chopper face detection (Base mobile net model)",
178
  description="Upload a Image for prediction or click on below examples",