Spaces:
Sleeping
Sleeping
another
Browse files
app.py
CHANGED
@@ -8,18 +8,14 @@ def convert(input):
|
|
8 |
path = input.name
|
9 |
print("Zip file path:", path)
|
10 |
|
11 |
-
|
12 |
-
os.system(f'unzip {path}')
|
13 |
-
path = path[:-4]
|
14 |
-
else:
|
15 |
-
raise ValueError('File must be a zip file')
|
16 |
|
|
|
|
|
17 |
print("Dicom folder path:", path)
|
18 |
-
|
19 |
print("This is the list of files in the folder:", os.listdir(path))
|
20 |
|
21 |
|
22 |
-
|
23 |
gr.Interface(
|
24 |
fn=convert,
|
25 |
inputs=gr.File(type="file", label="Dicom folder (.zip)", file_types=["zip"]),
|
|
|
8 |
path = input.name
|
9 |
print("Zip file path:", path)
|
10 |
|
11 |
+
assert path.endswith('.zip'), 'File must be a zip file'
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
os.system(f'unzip "{path}" -d "{path[:-4]}"')
|
14 |
+
path = path[:-4]
|
15 |
print("Dicom folder path:", path)
|
|
|
16 |
print("This is the list of files in the folder:", os.listdir(path))
|
17 |
|
18 |
|
|
|
19 |
gr.Interface(
|
20 |
fn=convert,
|
21 |
inputs=gr.File(type="file", label="Dicom folder (.zip)", file_types=["zip"]),
|