Spaces:
Sleeping
Sleeping
chengwang96 commited on
Commit ·
d70a23e
1
Parent(s): 1db65f3
update function 1
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- app.py +9 -11
- {f1_input → seg_input}/1.png +0 -0
- {f1_input → seg_input}/10.png +0 -0
- {f1_input → seg_input}/11.png +0 -0
- {f1_input → seg_input}/12.png +0 -0
- {f1_input → seg_input}/13.png +0 -0
- {f1_input → seg_input}/14.png +0 -0
- {f1_input → seg_input}/15.png +0 -0
- {f1_input → seg_input}/16.png +0 -0
- {f1_input → seg_input}/17.png +0 -0
- {f1_input → seg_input}/18.png +0 -0
- {f1_input → seg_input}/19.png +0 -0
- {f1_input → seg_input}/2.png +0 -0
- {f1_input → seg_input}/20.png +0 -0
- {f1_input → seg_input}/21.png +0 -0
- {f1_input → seg_input}/22.png +0 -0
- {f1_input → seg_input}/23.png +0 -0
- {f1_input → seg_input}/24.png +0 -0
- {f1_input → seg_input}/25.png +0 -0
- {f1_input → seg_input}/26.png +0 -0
- {f1_input → seg_input}/27.png +0 -0
- {f1_input → seg_input}/28.png +0 -0
- {f1_input → seg_input}/29.png +0 -0
- {f1_input → seg_input}/3.png +0 -0
- {f1_input → seg_input}/30.png +0 -0
- {f1_input → seg_input}/4.png +0 -0
- {f1_input → seg_input}/5.png +0 -0
- {f1_input → seg_input}/6.png +0 -0
- {f1_input → seg_input}/7.png +0 -0
- {f1_input → seg_input}/8.png +0 -0
- {f1_input → seg_input}/9.png +0 -0
- {f1_output → seg_output}/1.png +0 -0
- {f1_output → seg_output}/10.png +0 -0
- {f1_output → seg_output}/11.png +0 -0
- {f1_output → seg_output}/12.png +0 -0
- {f1_output → seg_output}/13.png +0 -0
- {f1_output → seg_output}/14.png +0 -0
- {f1_output → seg_output}/15.png +0 -0
- {f1_output → seg_output}/16.png +0 -0
- {f1_output → seg_output}/17.png +0 -0
- {f1_output → seg_output}/18.png +0 -0
- {f1_output → seg_output}/19.png +0 -0
- {f1_output → seg_output}/2.png +0 -0
- {f1_output → seg_output}/20.png +0 -0
- {f1_output → seg_output}/21.png +0 -0
- {f1_output → seg_output}/22.png +0 -0
- {f1_output → seg_output}/23.png +0 -0
- {f1_output → seg_output}/24.png +0 -0
- {f1_output → seg_output}/25.png +0 -0
- {f1_output → seg_output}/26.png +0 -0
app.py
CHANGED
|
@@ -5,18 +5,18 @@ import random
|
|
| 5 |
|
| 6 |
# ========== 配置图片路径 ==========
|
| 7 |
# 图像增强
|
| 8 |
-
ENHANCE_INPUT_DIR = "
|
| 9 |
-
ENHANCE_OUTPUT_DIR = "
|
| 10 |
-
ENHANCE_IMG_NAMES = [f"{i}.png" for i in range(1,
|
| 11 |
|
| 12 |
# 分割
|
| 13 |
SEG_INPUT_DIR = "seg_input"
|
| 14 |
SEG_OUTPUT_DIR = "seg_output"
|
| 15 |
-
SEG_IMG_NAMES = [f"{i}.png" for i in range(1,
|
| 16 |
|
| 17 |
# 诊断
|
| 18 |
DIAG_INPUT_DIR = "diag_input"
|
| 19 |
-
DIAG_IMG_NAMES = [f"{i}.png" for i in range(1,
|
| 20 |
|
| 21 |
# Kvasir 类别
|
| 22 |
KVASIR_CLASSES = [
|
|
@@ -38,7 +38,6 @@ def open_img(img_path):
|
|
| 38 |
return Image.new("RGB", (256, 256), (200, 200, 200))
|
| 39 |
return Image.open(img_path)
|
| 40 |
|
| 41 |
-
# 图像增强模块
|
| 42 |
def show_enhance_input(img_name):
|
| 43 |
path = os.path.join(ENHANCE_INPUT_DIR, img_name)
|
| 44 |
return open_img(path)
|
|
@@ -47,7 +46,6 @@ def enhance_demo(img_name):
|
|
| 47 |
path = os.path.join(ENHANCE_OUTPUT_DIR, img_name)
|
| 48 |
return open_img(path)
|
| 49 |
|
| 50 |
-
# 图像分割模块
|
| 51 |
def show_seg_input(img_name):
|
| 52 |
path = os.path.join(SEG_INPUT_DIR, img_name)
|
| 53 |
return open_img(path)
|
|
@@ -56,7 +54,6 @@ def segment_demo(img_name):
|
|
| 56 |
path = os.path.join(SEG_OUTPUT_DIR, img_name)
|
| 57 |
return open_img(path)
|
| 58 |
|
| 59 |
-
# 疾病诊断模块
|
| 60 |
def show_diag_input(img_name):
|
| 61 |
path = os.path.join(DIAG_INPUT_DIR, img_name)
|
| 62 |
return open_img(path)
|
|
@@ -70,14 +67,15 @@ def diagnose_demo(img_name):
|
|
| 70 |
with gr.Blocks(title="AI内窥镜影像辅助分析系统") as demo:
|
| 71 |
gr.Markdown("## AI内窥镜影像辅助分析系统")
|
| 72 |
|
| 73 |
-
# 上方:图像增强模块
|
| 74 |
with gr.Row():
|
| 75 |
with gr.Column():
|
| 76 |
gr.Markdown("### 图像增强模块")
|
| 77 |
enhance_select = gr.Dropdown(choices=ENHANCE_IMG_NAMES, value=ENHANCE_IMG_NAMES[0], label="选择样例图片", filterable=True)
|
| 78 |
-
|
|
|
|
|
|
|
| 79 |
enhance_btn = gr.Button("增强图片")
|
| 80 |
-
enhance_output_img = gr.Image(label="增强结果图片", interactive=False)
|
| 81 |
|
| 82 |
# 选择图片自动显示原图
|
| 83 |
enhance_select.change(fn=show_enhance_input, inputs=enhance_select, outputs=enhance_input_img)
|
|
|
|
| 5 |
|
| 6 |
# ========== 配置图片路径 ==========
|
| 7 |
# 图像增强
|
| 8 |
+
ENHANCE_INPUT_DIR = "sr_input"
|
| 9 |
+
ENHANCE_OUTPUT_DIR = "sr_output"
|
| 10 |
+
ENHANCE_IMG_NAMES = [f"{i}.png" for i in range(1, 30)]
|
| 11 |
|
| 12 |
# 分割
|
| 13 |
SEG_INPUT_DIR = "seg_input"
|
| 14 |
SEG_OUTPUT_DIR = "seg_output"
|
| 15 |
+
SEG_IMG_NAMES = [f"{i}.png" for i in range(1, 30)]
|
| 16 |
|
| 17 |
# 诊断
|
| 18 |
DIAG_INPUT_DIR = "diag_input"
|
| 19 |
+
DIAG_IMG_NAMES = [f"{i}.png" for i in range(1, 30)]
|
| 20 |
|
| 21 |
# Kvasir 类别
|
| 22 |
KVASIR_CLASSES = [
|
|
|
|
| 38 |
return Image.new("RGB", (256, 256), (200, 200, 200))
|
| 39 |
return Image.open(img_path)
|
| 40 |
|
|
|
|
| 41 |
def show_enhance_input(img_name):
|
| 42 |
path = os.path.join(ENHANCE_INPUT_DIR, img_name)
|
| 43 |
return open_img(path)
|
|
|
|
| 46 |
path = os.path.join(ENHANCE_OUTPUT_DIR, img_name)
|
| 47 |
return open_img(path)
|
| 48 |
|
|
|
|
| 49 |
def show_seg_input(img_name):
|
| 50 |
path = os.path.join(SEG_INPUT_DIR, img_name)
|
| 51 |
return open_img(path)
|
|
|
|
| 54 |
path = os.path.join(SEG_OUTPUT_DIR, img_name)
|
| 55 |
return open_img(path)
|
| 56 |
|
|
|
|
| 57 |
def show_diag_input(img_name):
|
| 58 |
path = os.path.join(DIAG_INPUT_DIR, img_name)
|
| 59 |
return open_img(path)
|
|
|
|
| 67 |
with gr.Blocks(title="AI内窥镜影像辅助分析系统") as demo:
|
| 68 |
gr.Markdown("## AI内窥镜影像辅助分析系统")
|
| 69 |
|
| 70 |
+
# 上方:图像增强模块(输入和输出在一行)
|
| 71 |
with gr.Row():
|
| 72 |
with gr.Column():
|
| 73 |
gr.Markdown("### 图像增强模块")
|
| 74 |
enhance_select = gr.Dropdown(choices=ENHANCE_IMG_NAMES, value=ENHANCE_IMG_NAMES[0], label="选择样例图片", filterable=True)
|
| 75 |
+
with gr.Row():
|
| 76 |
+
enhance_input_img = gr.Image(label="原始图片", interactive=False)
|
| 77 |
+
enhance_output_img = gr.Image(label="增强结果图片", interactive=False)
|
| 78 |
enhance_btn = gr.Button("增强图片")
|
|
|
|
| 79 |
|
| 80 |
# 选择图片自动显示原图
|
| 81 |
enhance_select.change(fn=show_enhance_input, inputs=enhance_select, outputs=enhance_input_img)
|
{f1_input → seg_input}/1.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/10.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/11.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/12.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/13.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/14.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/15.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/16.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/17.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/18.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/19.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/2.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/20.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/21.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/22.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/23.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/24.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/25.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/26.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/27.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/28.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/29.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/3.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/30.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/4.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/5.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/6.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/7.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/8.png
RENAMED
|
File without changes
|
{f1_input → seg_input}/9.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/1.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/10.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/11.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/12.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/13.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/14.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/15.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/16.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/17.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/18.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/19.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/2.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/20.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/21.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/22.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/23.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/24.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/25.png
RENAMED
|
File without changes
|
{f1_output → seg_output}/26.png
RENAMED
|
File without changes
|