File size: 495 Bytes
b40ec46
 
 
 
 
 
8ba74bb
 
 
 
 
 
 
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
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()