apailang commited on
Commit
49d69f8
Β·
1 Parent(s): ca411f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -41,7 +41,7 @@ def predict(pilimg,Threshold):
41
 
42
  image_np = pil_image_as_numpy_array(pilimg)
43
  if type(Threshold) is None:
44
- Threshold=0.38
45
 
46
  return predict2(image_np,Threshold),predict3(image_np,Threshold),Threshold
47
 
@@ -144,6 +144,7 @@ b = os.path.join(os.path.dirname(__file__), "data/c_tuned_detected.mp4") # Vide
144
  # return [video1, video2]
145
 
146
  label_id_offset = 0
 
147
  REPO_ID = "apailang/mytfodmodel"
148
  detection_model = load_model(REPO_ID)
149
  REPO_ID2 = "apailang/mytfodmodeltuned"
@@ -172,7 +173,7 @@ test12 = os.path.join(os.path.dirname(__file__), "data/test12.jpeg")
172
  base_image = gr.Interface(
173
  fn=predict,
174
  # 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")],
175
- inputs=[gr.Image(type="pil"),gr.Textbox(value=0.38 ,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")],
176
 
177
  outputs=[gr.Image(type="pil",label="Base Model Inference"),gr.Image(type="pil",label="Tuned Model Inference"),gr.Textbox(label="Tuned Model Inference")],
178
  title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",
 
41
 
42
  image_np = pil_image_as_numpy_array(pilimg)
43
  if type(Threshold) is None:
44
+ Threshold=threshold_d
45
 
46
  return predict2(image_np,Threshold),predict3(image_np,Threshold),Threshold
47
 
 
144
  # return [video1, video2]
145
 
146
  label_id_offset = 0
147
+ threshold_d=0.38
148
  REPO_ID = "apailang/mytfodmodel"
149
  detection_model = load_model(REPO_ID)
150
  REPO_ID2 = "apailang/mytfodmodeltuned"
 
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="Tuned Model Inference")],
179
  title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",