Update app.py
Browse files
app.py
CHANGED
|
@@ -103,11 +103,20 @@ def predict(input_image):
|
|
| 103 |
|
| 104 |
return image_pred, image_gt, gt_visibility
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
# Create Gradio interface
|
| 107 |
with gr.Blocks() as interface:
|
| 108 |
-
gr.Markdown("
|
| 109 |
gr.Markdown("Select an example or upload an image to see predictions.")
|
| 110 |
|
|
|
|
|
|
|
|
|
|
| 111 |
with gr.Row():
|
| 112 |
with gr.Column():
|
| 113 |
input_image = gr.Image(type="pil", label="Input Image")
|
|
|
|
| 103 |
|
| 104 |
return image_pred, image_gt, gt_visibility
|
| 105 |
|
| 106 |
+
# Generate the color legend markdown dynamically
|
| 107 |
+
legend_markdown = "### Color Legend\n\n"
|
| 108 |
+
for name, color in zip(class_names, colors):
|
| 109 |
+
color_rgb = f'rgb({color[0]},{color[1]},{color[2]})'
|
| 110 |
+
legend_markdown += f'- <span style="color: {color_rgb};">█</span> **{name}**\n'
|
| 111 |
+
|
| 112 |
# Create Gradio interface
|
| 113 |
with gr.Blocks() as interface:
|
| 114 |
+
gr.Markdown("## Advanced Detection of Cochlear Hair Cells Using YOLOv10 in Auditory Diagnostics")
|
| 115 |
gr.Markdown("Select an example or upload an image to see predictions.")
|
| 116 |
|
| 117 |
+
# Add the color legend
|
| 118 |
+
gr.Markdown(legend_markdown)
|
| 119 |
+
|
| 120 |
with gr.Row():
|
| 121 |
with gr.Column():
|
| 122 |
input_image = gr.Image(type="pil", label="Input Image")
|