Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,9 +38,10 @@ def load_model(model_repo_id):
|
|
| 38 |
|
| 39 |
|
| 40 |
def predict(pilimg,Threshold):
|
| 41 |
-
|
| 42 |
image_np = pil_image_as_numpy_array(pilimg)
|
| 43 |
-
|
|
|
|
| 44 |
Threshold=0.88
|
| 45 |
|
| 46 |
return predict2(image_np,Threshold),predict3(image_np,Threshold),Threshold
|
|
@@ -173,7 +174,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.
|
| 177 |
|
| 178 |
outputs=[gr.Image(type="pil",label="Base Model Inference"),gr.Image(type="pil",label="Tuned Model Inference"),gr.Textbox(label="[WIP]Both images inferenced threshold")],
|
| 179 |
title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
def predict(pilimg,Threshold):
|
| 41 |
+
|
| 42 |
image_np = pil_image_as_numpy_array(pilimg)
|
| 43 |
+
Threshold1= float(Threshold)
|
| 44 |
+
if type(Threshold1) is None or Threshold1 == 0:
|
| 45 |
Threshold=0.88
|
| 46 |
|
| 47 |
return predict2(image_np,Threshold),predict3(image_np,Threshold),Threshold
|
|
|
|
| 174 |
base_image = gr.Interface(
|
| 175 |
fn=predict,
|
| 176 |
# 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")],
|
| 177 |
+
inputs=[gr.Image(type="pil"),gr.Textbox(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")],
|
| 178 |
|
| 179 |
outputs=[gr.Image(type="pil",label="Base Model Inference"),gr.Image(type="pil",label="Tuned Model Inference"),gr.Textbox(label="[WIP]Both images inferenced threshold")],
|
| 180 |
title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",
|