osbm's picture
f
1b05017
raw
history blame
495 Bytes
import gradio as gr
import nibabel as nib
import os
def convert(input):
path = input.name
print("Zip file path:", path)
if path.endswith('.zip'):
os.system('unzip ' + path)
path = path[:-4]
else:
raise Exception('File must be a zip file')
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()