Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,7 +42,7 @@ def predict(pilimg,Threshold):
|
|
| 42 |
image_np = pil_image_as_numpy_array(pilimg)
|
| 43 |
|
| 44 |
if Threshold is None or Threshold == 0:
|
| 45 |
-
Threshold=
|
| 46 |
else:
|
| 47 |
Threshold= float(Threshold)
|
| 48 |
|
|
@@ -52,8 +52,8 @@ def predict2(image_np,Threshold):
|
|
| 52 |
|
| 53 |
results = detection_model(image_np)
|
| 54 |
|
| 55 |
-
if Threshold is None or Threshold == 0:
|
| 56 |
-
|
| 57 |
|
| 58 |
# different object detection models have additional results
|
| 59 |
result = {key:value.numpy() for key,value in results.items()}
|
|
@@ -179,11 +179,11 @@ test12 = os.path.join(os.path.dirname(__file__), "data/test12.jpeg")
|
|
| 179 |
base_image = gr.Interface(
|
| 180 |
fn=predict,
|
| 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="
|
| 183 |
|
| 184 |
-
outputs=[gr.Image(type="pil",label="Base Model Inference"),gr.Image(type="pil",label="Tuned Model Inference"),gr.Textbox(label="
|
| 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
|
| 187 |
examples=
|
| 188 |
[[test1],[test2],[test3],[test4],[test5],[test6],[test7],[test8],[test9],[test10],[test11],[test12],],
|
| 189 |
cache_examples=True,examples_per_page=12 #,label="select image with 0.38 threshold to inference, you may amend threshold after inference"
|
|
|
|
| 42 |
image_np = pil_image_as_numpy_array(pilimg)
|
| 43 |
|
| 44 |
if Threshold is None or Threshold == 0:
|
| 45 |
+
Threshold=threshold_d
|
| 46 |
else:
|
| 47 |
Threshold= float(Threshold)
|
| 48 |
|
|
|
|
| 52 |
|
| 53 |
results = detection_model(image_np)
|
| 54 |
|
| 55 |
+
# if Threshold is None or Threshold == 0:
|
| 56 |
+
# Threshold=threshold_d
|
| 57 |
|
| 58 |
# different object detection models have additional results
|
| 59 |
result = {key:value.numpy() for key,value in results.items()}
|
|
|
|
| 179 |
base_image = gr.Interface(
|
| 180 |
fn=predict,
|
| 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. Range 0.01 to 1",info="Select any image below to start, you may amend threshold after first 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 is defaut t >38%, you may adjust after first inference",
|
| 187 |
examples=
|
| 188 |
[[test1],[test2],[test3],[test4],[test5],[test6],[test7],[test8],[test9],[test10],[test11],[test12],],
|
| 189 |
cache_examples=True,examples_per_page=12 #,label="select image with 0.38 threshold to inference, you may amend threshold after inference"
|