Spaces:
Sleeping
Sleeping
File size: 619 Bytes
b40ec46 298a539 b40ec46 298a539 b40ec46 8ba74bb 298a539 d44ceac 298a539 d44ceac 298a539 b40ec46 1b05017 b40ec46 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
import nibabel as nib
import pydicom
import os
def convert(input):
# if linux
path = input.name
print("Zip file path:", path)
assert path.endswith('.zip'), 'File must be a zip file'
os.system(f'unzip "{path}" -d "{path[:-4]}"')
path = path[:-4]
print("Dicom folder path:", path)
print("This is the list of files in the folder:", os.listdir(path))
gr.Interface(
fn=convert,
inputs=gr.File(type="file", label="Dicom folder (.zip)", file_types=["zip"]),
outputs="file",
title="Convert a Dicom folder to a Nifti (.nii.gz) file",
).launch() |