apailang commited on
Commit
9227f5d
β€’
1 Parent(s): 49d69f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -48,7 +48,10 @@ def predict(pilimg,Threshold):
48
  def predict2(image_np,Threshold):
49
 
50
  results = detection_model(image_np)
51
-
 
 
 
52
  # different object detection models have additional results
53
  result = {key:value.numpy() for key,value in results.items()}
54
 
@@ -73,7 +76,10 @@ def predict2(image_np,Threshold):
73
 
74
 
75
  def predict3(image_np,Threshold):
76
-
 
 
 
77
  results = detection_model2(image_np)
78
 
79
  # different object detection models have additional results
@@ -175,7 +181,7 @@ base_image = gr.Interface(
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",
180
  description="Upload a Image for prediction or click on below examples. Prediction confident >38% will be shown in dectected images. Threshold slider is WIP",
181
  examples=
 
48
  def predict2(image_np,Threshold):
49
 
50
  results = detection_model(image_np)
51
+
52
+ if type(Threshold) is None:
53
+ Threshold=threshold_d
54
+
55
  # different object detection models have additional results
56
  result = {key:value.numpy() for key,value in results.items()}
57
 
 
76
 
77
 
78
  def predict3(image_np,Threshold):
79
+
80
+ if type(Threshold) is None:
81
+ Threshold=threshold_d
82
+
83
  results = detection_model2(image_np)
84
 
85
  # different object detection models have additional results
 
181
  # 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")],
182
  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")],
183
 
184
+ outputs=[gr.Image(type="pil",label="Base Model Inference"),gr.Image(type="pil",label="Tuned Model Inference"),gr.Textbox(label="Both images inferenced threshold")],
185
  title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",
186
  description="Upload a Image for prediction or click on below examples. Prediction confident >38% will be shown in dectected images. Threshold slider is WIP",
187
  examples=