Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ from PIL import Image, ImageOps
|
|
| 6 |
import numpy as np
|
| 7 |
import gradio as gr
|
| 8 |
import os
|
|
|
|
| 9 |
|
| 10 |
class DoubleConv(nn.Module):
|
| 11 |
def __init__(self, in_channels, out_channels):
|
|
@@ -228,11 +229,14 @@ desc = "Pipeline: UNet -> mask lungs -> two binary classifiers (Normal vs Bacter
|
|
| 228 |
"If both classifiers fire, the stronger probability is chosen (fallback). Thresholds adjustable."
|
| 229 |
|
| 230 |
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
| 232 |
example_samples = [
|
| 233 |
-
['images/NORMAL.jpeg',"NORMAL"],
|
| 234 |
-
['images/VIRAL.jpeg',"VIRAL"],
|
| 235 |
-
['images/BACT.jpeg',"BACTERIAL"],
|
| 236 |
]
|
| 237 |
|
| 238 |
with gr.Blocks(title=title) as demo:
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
import gradio as gr
|
| 8 |
import os
|
| 9 |
+
import base64
|
| 10 |
|
| 11 |
class DoubleConv(nn.Module):
|
| 12 |
def __init__(self, in_channels, out_channels):
|
|
|
|
| 229 |
"If both classifiers fire, the stronger probability is chosen (fallback). Thresholds adjustable."
|
| 230 |
|
| 231 |
|
| 232 |
+
def encode_image(img_path):
|
| 233 |
+
with open(img_path, "rb") as img:
|
| 234 |
+
return "data:image/png;base64," + base64.b64encode(img.read()).decode()
|
| 235 |
+
|
| 236 |
example_samples = [
|
| 237 |
+
[f"<img src='{encode_image('images/NORMAL.jpeg')}' width='120'>", "NORMAL"],
|
| 238 |
+
[f"<img src='{encode_image('images/VIRAL.jpeg')}' width='120'>", "VIRAL"],
|
| 239 |
+
[f"<img src='{encode_image('images/BACT.jpeg')}' width='120'>", "BACTERIAL"],
|
| 240 |
]
|
| 241 |
|
| 242 |
with gr.Blocks(title=title) as demo:
|