Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import pydicom
|
| 3 |
-
import matplotlib.pyplot as plt
|
| 4 |
-
import zipfile
|
| 5 |
import os
|
|
|
|
| 6 |
import subprocess
|
| 7 |
-
from datetime import datetime
|
| 8 |
-
import shutil
|
| 9 |
-
import moviepy.video.io.ImageSequenceClip
|
| 10 |
-
from io import BytesIO
|
| 11 |
-
from tkinter import Tcl
|
| 12 |
-
from PIL import Image
|
| 13 |
-
|
| 14 |
-
subprocess_executed = False
|
| 15 |
|
| 16 |
logo_image_path = '1.png'
|
| 17 |
|
|
@@ -51,17 +41,19 @@ def search_file(start_path, target_file):
|
|
| 51 |
return os.path.join(root, target_file)
|
| 52 |
return None
|
| 53 |
|
| 54 |
-
def
|
| 55 |
-
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
|
| 61 |
first_subdirectory = subdirectories[0] if subdirectories else None
|
| 62 |
|
| 63 |
if first_subdirectory:
|
| 64 |
-
subdirectory_path = os.path.join(
|
| 65 |
temp_dicom_dir_path = os.path.join(subdirectory_path, "temp_dicom_dir")
|
| 66 |
|
| 67 |
for root, dirs, _ in os.walk(temp_dicom_dir_path):
|
|
@@ -89,7 +81,7 @@ def fetch_outputs():
|
|
| 89 |
else:
|
| 90 |
st.warning("Output files not found")
|
| 91 |
else:
|
| 92 |
-
st.error("Output
|
| 93 |
|
| 94 |
def main():
|
| 95 |
st.write("Upload a ZIP file containing DICOM slices")
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
| 2 |
import os
|
| 3 |
+
import zipfile
|
| 4 |
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
logo_image_path = '1.png'
|
| 7 |
|
|
|
|
| 41 |
return os.path.join(root, target_file)
|
| 42 |
return None
|
| 43 |
|
| 44 |
+
def resolve_path(base_path):
|
| 45 |
+
return os.path.abspath(os.path.join(base_path, "C2C/comp2comp/utils/../../outputs"))
|
| 46 |
|
| 47 |
+
def fetch_outputs():
|
| 48 |
+
outputs_base_path = resolve_path("/home/user/app")
|
| 49 |
+
if os.path.exists(outputs_base_path):
|
| 50 |
+
subdirectories = [subdir for subdir in os.listdir(outputs_base_path)
|
| 51 |
+
if os.path.isdir(os.path.join(outputs_base_path, subdir))]
|
| 52 |
|
| 53 |
first_subdirectory = subdirectories[0] if subdirectories else None
|
| 54 |
|
| 55 |
if first_subdirectory:
|
| 56 |
+
subdirectory_path = os.path.join(outputs_base_path, first_subdirectory)
|
| 57 |
temp_dicom_dir_path = os.path.join(subdirectory_path, "temp_dicom_dir")
|
| 58 |
|
| 59 |
for root, dirs, _ in os.walk(temp_dicom_dir_path):
|
|
|
|
| 81 |
else:
|
| 82 |
st.warning("Output files not found")
|
| 83 |
else:
|
| 84 |
+
st.error("Output directory not found")
|
| 85 |
|
| 86 |
def main():
|
| 87 |
st.write("Upload a ZIP file containing DICOM slices")
|