Commit
·
d606a36
1
Parent(s):
1151132
moving unzip and wget to app.py
Browse files- Dockerfile +11 -11
- app.py +18 -2
- packages.txt +2 -0
- requirements.txt +2 -1
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.10.12
|
| 3 |
|
| 4 |
-
RUN apt-get update && apt-get install -y unzip wget
|
| 5 |
|
| 6 |
# Set up a new user named "user" with user ID 1000
|
| 7 |
RUN useradd -m -u 1000 user
|
|
@@ -29,21 +29,21 @@ COPY --chown=user . $HOME/app
|
|
| 29 |
# RUN wget https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zip && \
|
| 30 |
# unzip dcm2niix_lnx.zip && \
|
| 31 |
# cp dcm2niix /home/user/.local/bin
|
| 32 |
-
RUN pip install git+https://github.com/rordenlab/dcm2niix.git
|
| 33 |
-
RUN dcm2niix -h
|
| 34 |
|
| 35 |
# Install any needed packages specified in requirements.txt
|
| 36 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 37 |
|
| 38 |
-
# Download files as the non-root user
|
| 39 |
-
RUN wget -O scaling_factors.csv https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/scaling_factors.csv
|
| 40 |
-
RUN wget -O metadata_only_model.zip https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/metadata_only_model.zip
|
| 41 |
-
RUN wget -O images_only_model.zip https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/images_only_model.zip
|
| 42 |
-
RUN wget -O images_and_metadata_model.zip https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/images_and_metadata_model.zip
|
| 43 |
|
| 44 |
-
RUN unzip "metadata_only_model.zip" -d "metadata_only_model/"
|
| 45 |
-
RUN unzip "images_only_model.zip" -d "images_only_model/"
|
| 46 |
-
RUN unzip "images_and_metadata_model.zip" -d "images_and_metadata_model/"
|
| 47 |
|
| 48 |
# Create the .streamlit directory
|
| 49 |
RUN mkdir -p .streamlit
|
|
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.10.12
|
| 3 |
|
| 4 |
+
# RUN apt-get update && apt-get install -y unzip wget
|
| 5 |
|
| 6 |
# Set up a new user named "user" with user ID 1000
|
| 7 |
RUN useradd -m -u 1000 user
|
|
|
|
| 29 |
# RUN wget https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zip && \
|
| 30 |
# unzip dcm2niix_lnx.zip && \
|
| 31 |
# cp dcm2niix /home/user/.local/bin
|
| 32 |
+
# RUN pip install git+https://github.com/rordenlab/dcm2niix.git
|
| 33 |
+
# RUN dcm2niix -h
|
| 34 |
|
| 35 |
# Install any needed packages specified in requirements.txt
|
| 36 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 37 |
|
| 38 |
+
# # Download files as the non-root user
|
| 39 |
+
# RUN wget -O scaling_factors.csv https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/scaling_factors.csv
|
| 40 |
+
# RUN wget -O metadata_only_model.zip https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/metadata_only_model.zip
|
| 41 |
+
# RUN wget -O images_only_model.zip https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/images_only_model.zip
|
| 42 |
+
# RUN wget -O images_and_metadata_model.zip https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/images_and_metadata_model.zip
|
| 43 |
|
| 44 |
+
# RUN unzip "metadata_only_model.zip" -d "metadata_only_model/"
|
| 45 |
+
# RUN unzip "images_only_model.zip" -d "images_only_model/"
|
| 46 |
+
# RUN unzip "images_and_metadata_model.zip" -d "images_and_metadata_model/"
|
| 47 |
|
| 48 |
# Create the .streamlit directory
|
| 49 |
RUN mkdir -p .streamlit
|
app.py
CHANGED
|
@@ -56,12 +56,24 @@ print('selected_series: ' + str(selected_series))
|
|
| 56 |
if st.button("Run inference"):
|
| 57 |
|
| 58 |
# Code to run when the button is pressed
|
| 59 |
-
st.write("
|
| 60 |
|
| 61 |
if os.path.exists("DICOMScanClassification_user_demo.ipynb"):
|
| 62 |
os.remove("DICOMScanClassification_user_demo.ipynb")
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
# pm.execute_notebook(
|
| 67 |
# "DICOMScanClassification_user_demo.ipynb",
|
|
@@ -78,5 +90,9 @@ if st.button("Run inference"):
|
|
| 78 |
file_name="output.ipynb",
|
| 79 |
mime="application/json"
|
| 80 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
|
|
|
|
| 56 |
if st.button("Run inference"):
|
| 57 |
|
| 58 |
# Code to run when the button is pressed
|
| 59 |
+
st.write("Running inference")
|
| 60 |
|
| 61 |
if os.path.exists("DICOMScanClassification_user_demo.ipynb"):
|
| 62 |
os.remove("DICOMScanClassification_user_demo.ipynb")
|
| 63 |
|
| 64 |
+
if not os.path.exists("DICOMScanClassification_user_demo.ipynb"):
|
| 65 |
+
subprocess.run(["wget", "https://raw.githubusercontent.com/deepakri201/DICOMScanClassification_pw41/main/DICOMScanClassification_user_demo.ipynb"])
|
| 66 |
+
if not os.path.exists("scaling_factors.csv"):
|
| 67 |
+
subprocess.run(["wget", "-O", "scaling_factors.csv", "https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/scaling_factors.csv"])
|
| 68 |
+
if not os.path.exists("metadata_only_model.zip"):
|
| 69 |
+
subprocess.run(["wget", "-O", "metadata_only_model.zip", "https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/metadata_only_model.zip"])
|
| 70 |
+
subprocess.run(["unzip", "metadata_only_model.zip", -d, "metadata_only_model/"])
|
| 71 |
+
if not os.path.exists("images_only_model.zip"):
|
| 72 |
+
subprocess.run(["wget", "-O", "images_only_model.zip", "https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/images_only_model.zip"])
|
| 73 |
+
subprocess.run(["unzip", "images_only_model.zip", -d, "images_only_model/"])
|
| 74 |
+
if not os.path.exists("images_and_metadata_model.zip"):
|
| 75 |
+
subprocess.run(["wget", "-O", "images_and_metadata_model.zip", "https://github.com/deepakri201/DICOMScanClassification/releases/download/v1.0.0/images_and_metadata_model.zip"])
|
| 76 |
+
subprocess.run(["unzip", "images_and_metadata_model.zip", -d, "images_and_metadata_model/"])
|
| 77 |
|
| 78 |
# pm.execute_notebook(
|
| 79 |
# "DICOMScanClassification_user_demo.ipynb",
|
|
|
|
| 90 |
file_name="output.ipynb",
|
| 91 |
mime="application/json"
|
| 92 |
)
|
| 93 |
+
|
| 94 |
+
# Show 2D image
|
| 95 |
+
|
| 96 |
+
# Display classification results in a table - display dataframe
|
| 97 |
|
| 98 |
|
packages.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
unzip
|
| 2 |
+
wget
|
requirements.txt
CHANGED
|
@@ -13,4 +13,5 @@ nibabel==4.0.2
|
|
| 13 |
matplotlib==3.7.1
|
| 14 |
scikit-learn==1.2.2
|
| 15 |
sklearn-pandas
|
| 16 |
-
numpy==1.25.2
|
|
|
|
|
|
| 13 |
matplotlib==3.7.1
|
| 14 |
scikit-learn==1.2.2
|
| 15 |
sklearn-pandas
|
| 16 |
+
numpy==1.25.2
|
| 17 |
+
dcmniix==1.0.20220715
|