Spaces:
Sleeping
Sleeping
File size: 1,070 Bytes
3e76049 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import gradio as gr
import kagglehub
import os
from processing import analyze_pneumothorax
# Download dataset
dataset_path = kagglehub.dataset_download("kmader/siim-medical-images")
print("Path to dataset files:", dataset_path)
# Find a DICOM file in the dataset (for testing)
def find_dicom_file(dataset_path):
for root, _, files in os.walk(dataset_path):
for file in files:
if file.endswith(".dcm"):
return os.path.join(root, file)
return None
test_dicom_path = find_dicom_file(dataset_path)
if test_dicom_path is None:
print("No DICOM files found in the dataset.")
else:
print(f"Found a DICOM file for testing: {test_dicom_path}")
iface = gr.Interface(
fn=analyze_pneumothorax,
inputs=gr.File(type="filepath", label="Upload DICOM Image"),
outputs=gr.Image(type="pil", label="Segmented Image"),
title="Pneumothorax Segmentation",
description="This is a simplified application that uses machine learning to analyze images using segmentation."
)
iface.launch() |