Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,8 +31,9 @@ def show_preds(input_image, detection_threshold=0.5):
|
|
| 31 |
img = draw_pred(img=img, pred=pred, class_map=class_map, display_label=False, display_bbox=True)
|
| 32 |
img = PIL.Image.fromarray(img)
|
| 33 |
pred_bbox = pred['bboxes']
|
|
|
|
| 34 |
# print("Output Image: ", img.size, type(img))
|
| 35 |
-
return img, pred_bbox
|
| 36 |
|
| 37 |
# Populate examples in Gradio interface
|
| 38 |
examples = [
|
|
@@ -46,7 +47,7 @@ description = "An object detection framework to localize regions under post-admi
|
|
| 46 |
gr_interface = gr.Interface(
|
| 47 |
fn=show_preds,
|
| 48 |
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")],
|
| 49 |
-
outputs=[gr.Image(type="pil"), gr.Textbox(label="Predicted BBox:")],
|
| 50 |
title='Detect adaptive variants in admixed populations',
|
| 51 |
description=description,
|
| 52 |
examples=examples)
|
|
|
|
| 31 |
img = draw_pred(img=img, pred=pred, class_map=class_map, display_label=False, display_bbox=True)
|
| 32 |
img = PIL.Image.fromarray(img)
|
| 33 |
pred_bbox = pred['bboxes']
|
| 34 |
+
pred_score = pred['scores']
|
| 35 |
# print("Output Image: ", img.size, type(img))
|
| 36 |
+
return img, pred_bbox, pred_score
|
| 37 |
|
| 38 |
# Populate examples in Gradio interface
|
| 39 |
examples = [
|
|
|
|
| 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:"), gr.Textbox(label="Predicted BBox Score:")],
|
| 51 |
title='Detect adaptive variants in admixed populations',
|
| 52 |
description=description,
|
| 53 |
examples=examples)
|