apailang commited on
Commit
daa2091
Β·
1 Parent(s): 7b43c97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -37,12 +37,12 @@ def load_model(model_repo_id):
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,7 +60,7 @@ def predict2(image_np):
60
  category_index,
61
  use_normalized_coordinates=True,
62
  max_boxes_to_draw=200,
63
- min_score_thresh=.60,
64
  agnostic_mode=False,
65
  line_thickness=2)
66
 
@@ -172,7 +172,7 @@ test12 = os.path.join(os.path.dirname(__file__), "data/test12.jpeg")
172
 
173
  base_image = gr.Interface(
174
  fn=predict,
175
- inputs=gr.Image(type="pil"),
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",
 
37
  return detection_model
38
 
39
 
40
+ def predict(pilimg,threshold):
41
 
42
  image_np = pil_image_as_numpy_array(pilimg)
43
+ return predict2(image_np,threshold)
44
 
45
+ def predict2(image_np,threshold):
46
 
47
  results = detection_model(image_np)
48
 
 
60
  category_index,
61
  use_normalized_coordinates=True,
62
  max_boxes_to_draw=200,
63
+ min_score_thresh=threshold,
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, default=0.5, label="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",