Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,9 +24,10 @@ def predict(model, image, detection_threshold: float = 0.5):
|
|
| 24 |
return samples[0]["img"], preds[0]
|
| 25 |
|
| 26 |
|
| 27 |
-
def show_preds(input_image):
|
|
|
|
| 28 |
|
| 29 |
-
img, pred = predict(model=model, image=input_image, detection_threshold
|
| 30 |
# print(pred)
|
| 31 |
img = draw_pred(img=img, pred=pred, class_map=class_map, display_label=False, display_bbox=True)
|
| 32 |
img = PIL.Image.fromarray(img)
|
|
@@ -45,7 +46,7 @@ description = "An object detection framework to localize regions under post-admi
|
|
| 45 |
|
| 46 |
gr_interface = gr.Interface(
|
| 47 |
fn=show_preds,
|
| 48 |
-
inputs=["image"],
|
| 49 |
outputs=[gr.Image(type="pil"), gr.Textbox(label="Predicted BBox:")],
|
| 50 |
title='Detect adaptive variants in admixed populations',
|
| 51 |
description=description,
|
|
|
|
| 24 |
return samples[0]["img"], preds[0]
|
| 25 |
|
| 26 |
|
| 27 |
+
def show_preds(input_image, detection_threshold):
|
| 28 |
+
if detection_threshold==0: detection_threshold=0.5
|
| 29 |
|
| 30 |
+
img, pred = predict(model=model, image=input_image, detection_threshold)
|
| 31 |
# print(pred)
|
| 32 |
img = draw_pred(img=img, pred=pred, class_map=class_map, display_label=False, display_bbox=True)
|
| 33 |
img = PIL.Image.fromarray(img)
|
|
|
|
| 46 |
|
| 47 |
gr_interface = gr.Interface(
|
| 48 |
fn=show_preds,
|
| 49 |
+
inputs=[gr.Image(label="Upload 200x200 B&W image of ancestry-painted chromosomes:"), gr.Slider(minimum=0, maximum=1, step=0.1, default=0.5, label="Detection Threshold")],
|
| 50 |
outputs=[gr.Image(type="pil"), gr.Textbox(label="Predicted BBox:")],
|
| 51 |
title='Detect adaptive variants in admixed populations',
|
| 52 |
description=description,
|