Spaces:
Build error
Build error
DHEENA0007
Claude
commited on
Commit
Β·
cbbde4c
1
Parent(s):
b2413b5
Add MRI report generator application with Docker support
Browse filesThis commit includes:
- Updated Dockerfiles for all containers (ETL, Jupyter, PhysioNet, Streamlit, Train)
- Updated requirements.txt for Streamlit and Train containers
- Docker Compose configuration for orchestrating services
- Streamlit application for MRI report generation
- Setup scripts for virtual environment and application startup
- Project dependencies and requirements
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- containers/etl/Dockerfile +3 -8
- containers/jupyter/Dockerfile +3 -8
- containers/physionet/Dockerfile +1 -1
- containers/streamlit/Dockerfile +11 -11
- containers/streamlit/requirements.txt +5 -3
- containers/train/Dockerfile +9 -9
- containers/train/requirements.txt +5 -3
- docker-compose.yaml +0 -1
- requirements.txt +26 -0
- setup_venv.py +129 -0
- start_app.bat +55 -0
- start_app.sh +70 -0
- streamlit_app.py +0 -0
containers/etl/Dockerfile
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
-
FROM python:3.9-
|
| 2 |
|
| 3 |
RUN \
|
| 4 |
apt-get update && \
|
| 5 |
-
apt-get -y upgrade && \
|
| 6 |
apt-get clean && \
|
| 7 |
rm -rf /var/lib/apt/lists/*
|
| 8 |
|
|
@@ -24,14 +23,10 @@ RUN \
|
|
| 24 |
chown app:app /home/app/common.py && \
|
| 25 |
chmod 0755 /home/app/common.py
|
| 26 |
|
| 27 |
-
USER app
|
| 28 |
-
|
| 29 |
-
ENV VIRTUAL_ENV=/home/app/venv
|
| 30 |
-
RUN python3 -m venv $VIRTUAL_ENV
|
| 31 |
-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
| 32 |
-
|
| 33 |
RUN \
|
| 34 |
pip install --upgrade pip && \
|
| 35 |
pip install -r requirements.txt
|
| 36 |
|
|
|
|
|
|
|
| 37 |
CMD ["python", "run.py", "worker", "-l", "info"]
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
| 2 |
|
| 3 |
RUN \
|
| 4 |
apt-get update && \
|
|
|
|
| 5 |
apt-get clean && \
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
|
|
|
| 23 |
chown app:app /home/app/common.py && \
|
| 24 |
chmod 0755 /home/app/common.py
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
RUN \
|
| 27 |
pip install --upgrade pip && \
|
| 28 |
pip install -r requirements.txt
|
| 29 |
|
| 30 |
+
USER app
|
| 31 |
+
|
| 32 |
CMD ["python", "run.py", "worker", "-l", "info"]
|
containers/jupyter/Dockerfile
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
-
FROM python:3.9-
|
| 2 |
|
| 3 |
RUN \
|
| 4 |
apt-get update && \
|
| 5 |
-
apt-get -y upgrade && \
|
| 6 |
apt-get clean && \
|
| 7 |
rm -rf /var/lib/apt/lists/*
|
| 8 |
|
|
@@ -15,14 +14,10 @@ RUN \
|
|
| 15 |
chown app:app /home/app/requirements.txt && \
|
| 16 |
chmod 0755 /home/app/requirements.txt
|
| 17 |
|
| 18 |
-
USER app
|
| 19 |
-
|
| 20 |
-
ENV VIRTUAL_ENV=/home/app/venv
|
| 21 |
-
RUN python3 -m venv $VIRTUAL_ENV
|
| 22 |
-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
| 23 |
-
|
| 24 |
RUN \
|
| 25 |
pip install --upgrade pip && \
|
| 26 |
pip install -r requirements.txt
|
| 27 |
|
|
|
|
|
|
|
| 28 |
CMD ["jupyter", "notebook", "--notebook-dir=/opt/notebooks", "--ip='*'", "--port=8888", "--no-browser"]
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
| 2 |
|
| 3 |
RUN \
|
| 4 |
apt-get update && \
|
|
|
|
| 5 |
apt-get clean && \
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
|
|
|
| 14 |
chown app:app /home/app/requirements.txt && \
|
| 15 |
chmod 0755 /home/app/requirements.txt
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
RUN \
|
| 18 |
pip install --upgrade pip && \
|
| 19 |
pip install -r requirements.txt
|
| 20 |
|
| 21 |
+
USER app
|
| 22 |
+
|
| 23 |
CMD ["jupyter", "notebook", "--notebook-dir=/opt/notebooks", "--ip='*'", "--port=8888", "--no-browser"]
|
containers/physionet/Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
FROM debian:
|
| 2 |
|
| 3 |
RUN apt-get update -y && \
|
| 4 |
apt-get -y install parallel wget && \
|
|
|
|
| 1 |
+
FROM debian:bookworm
|
| 2 |
|
| 3 |
RUN apt-get update -y && \
|
| 4 |
apt-get -y install parallel wget && \
|
containers/streamlit/Dockerfile
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
-
FROM python:3.9-
|
| 2 |
|
| 3 |
RUN \
|
| 4 |
apt-get update && \
|
| 5 |
-
apt-get -y upgrade && \
|
| 6 |
apt-get clean && \
|
| 7 |
rm -rf /var/lib/apt/lists/*
|
| 8 |
|
|
@@ -15,17 +14,18 @@ RUN \
|
|
| 15 |
chown app:app /home/app/requirements.txt && \
|
| 16 |
chmod 0755 /home/app/requirements.txt && \
|
| 17 |
chown app:app /home/app/app.py && \
|
| 18 |
-
chmod 0755 /home/app/app.py
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
-
RUN
|
| 25 |
-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
|
| 31 |
CMD ["streamlit", "run", "app.py"]
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
| 2 |
|
| 3 |
RUN \
|
| 4 |
apt-get update && \
|
|
|
|
| 5 |
apt-get clean && \
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
|
|
|
| 14 |
chown app:app /home/app/requirements.txt && \
|
| 15 |
chmod 0755 /home/app/requirements.txt && \
|
| 16 |
chown app:app /home/app/app.py && \
|
| 17 |
+
chmod 0755 /home/app/app.py
|
| 18 |
|
| 19 |
+
RUN \
|
| 20 |
+
pip install --upgrade pip
|
| 21 |
|
| 22 |
+
# Install PyTorch separately from CPU index
|
| 23 |
+
RUN pip install --index-url https://download.pytorch.org/whl/cpu torch>=2.0.0
|
|
|
|
| 24 |
|
| 25 |
+
# Install other requirements from default PyPI
|
| 26 |
+
RUN pip install streamlit>=1.28.0 transformers>=4.36.0 pillow>=10.0.0
|
| 27 |
+
|
| 28 |
+
USER app
|
| 29 |
+
WORKDIR /home/app
|
| 30 |
|
| 31 |
CMD ["streamlit", "run", "app.py"]
|
containers/streamlit/requirements.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
-
streamlit>=1.
|
| 2 |
-
transformers
|
| 3 |
-
pillow>=
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit>=1.28.0
|
| 2 |
+
transformers>=4.36.0
|
| 3 |
+
pillow>=10.0.0
|
| 4 |
+
regex>=2023.0.0
|
| 5 |
+
torch>=2.0.0 --index-url https://download.pytorch.org/whl/cpu
|
containers/train/Dockerfile
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
-
FROM python:3.9-
|
| 2 |
|
| 3 |
RUN \
|
| 4 |
apt-get update && \
|
| 5 |
-
apt-get -y upgrade && \
|
| 6 |
apt-get clean && \
|
| 7 |
rm -rf /var/lib/apt/lists/*
|
| 8 |
|
|
@@ -18,14 +17,15 @@ RUN \
|
|
| 18 |
chown app:app /home/app/run.py && \
|
| 19 |
chmod 0755 /home/app/run.py
|
| 20 |
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
RUN
|
| 25 |
-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
CMD ["python", "run.py", "worker", "-l", "info"]
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
| 2 |
|
| 3 |
RUN \
|
| 4 |
apt-get update && \
|
|
|
|
| 5 |
apt-get clean && \
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
|
|
|
| 17 |
chown app:app /home/app/run.py && \
|
| 18 |
chmod 0755 /home/app/run.py
|
| 19 |
|
| 20 |
+
RUN \
|
| 21 |
+
pip install --upgrade pip
|
| 22 |
|
| 23 |
+
# Install PyTorch separately from CPU index
|
| 24 |
+
RUN pip install --index-url https://download.pytorch.org/whl/cpu torch>=2.0.0
|
|
|
|
| 25 |
|
| 26 |
+
# Install other requirements from default PyPI
|
| 27 |
+
RUN pip install transformers>=4.36.0 pillow>=10.0.0 datasets>=2.14.0
|
| 28 |
+
|
| 29 |
+
USER app
|
| 30 |
|
| 31 |
CMD ["python", "run.py", "worker", "-l", "info"]
|
containers/train/requirements.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
-
transformers
|
| 2 |
-
pillow>=
|
| 3 |
-
datasets>=2.
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers>=4.36.0
|
| 2 |
+
pillow>=10.0.0
|
| 3 |
+
datasets>=2.14.0
|
| 4 |
+
regex>=2023.0.0
|
| 5 |
+
torch>=2.0.0 --index-url https://download.pytorch.org/whl/cpu
|
docker-compose.yaml
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
version: '3'
|
| 2 |
services:
|
| 3 |
|
| 4 |
# download data
|
|
|
|
|
|
|
| 1 |
services:
|
| 2 |
|
| 3 |
# download data
|
requirements.txt
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Prerad Project Root Requirements
|
| 2 |
+
# Main dependencies for the project (CPU-only PyTorch)
|
| 3 |
+
# Updated for Python 3.13 compatibility
|
| 4 |
+
|
| 5 |
+
# Web Framework
|
| 6 |
+
streamlit>=1.28.0
|
| 7 |
+
|
| 8 |
+
# Machine Learning & Computer Vision
|
| 9 |
+
transformers>=4.36.0
|
| 10 |
+
pillow>=10.0.0
|
| 11 |
+
regex>=2023.0.0
|
| 12 |
+
|
| 13 |
+
# PyTorch CPU version (latest stable)
|
| 14 |
+
# Install with: pip install torch --index-url https://download.pytorch.org/whl/cpu
|
| 15 |
+
torch>=2.0.0
|
| 16 |
+
|
| 17 |
+
# Data Processing
|
| 18 |
+
pandas>=2.0.0
|
| 19 |
+
jsonlines>=4.0.0
|
| 20 |
+
|
| 21 |
+
# Jupyter & Notebooks
|
| 22 |
+
jupyter>=1.0.0
|
| 23 |
+
ipykernel>=6.25.0
|
| 24 |
+
|
| 25 |
+
# Additional utilities
|
| 26 |
+
numpy>=1.24.0
|
setup_venv.py
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
so#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Setup script to create a virtual environment and install dependencies for the Prerad project.
|
| 4 |
+
This script creates a venv at the project path and installs all necessary packages.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import os
|
| 8 |
+
import sys
|
| 9 |
+
import subprocess
|
| 10 |
+
import venv
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
def main():
|
| 14 |
+
# Define paths
|
| 15 |
+
project_path = Path("/run/media/dheena/Leave you files/prerad")
|
| 16 |
+
venv_path = project_path / "venv"
|
| 17 |
+
|
| 18 |
+
print(f"π Setting up Prerad project environment")
|
| 19 |
+
print(f"π Project path: {project_path}")
|
| 20 |
+
print(f"π¦ Virtual environment path: {venv_path}")
|
| 21 |
+
print()
|
| 22 |
+
|
| 23 |
+
# Step 1: Create virtual environment
|
| 24 |
+
print("Step 1: Creating virtual environment...")
|
| 25 |
+
try:
|
| 26 |
+
venv.create(venv_path, with_pip=True)
|
| 27 |
+
print(f"β
Virtual environment created at {venv_path}")
|
| 28 |
+
except Exception as e:
|
| 29 |
+
print(f"β Error creating virtual environment: {e}")
|
| 30 |
+
sys.exit(1)
|
| 31 |
+
|
| 32 |
+
# Step 2: Determine pip executable path
|
| 33 |
+
if sys.platform == "win32":
|
| 34 |
+
pip_exe = venv_path / "Scripts" / "pip.exe"
|
| 35 |
+
python_exe = venv_path / "Scripts" / "python.exe"
|
| 36 |
+
else:
|
| 37 |
+
pip_exe = venv_path / "bin" / "pip"
|
| 38 |
+
python_exe = venv_path / "bin" / "python"
|
| 39 |
+
|
| 40 |
+
print()
|
| 41 |
+
print("Step 2: Upgrading pip...")
|
| 42 |
+
try:
|
| 43 |
+
subprocess.check_call([str(pip_exe), "install", "--upgrade", "pip"])
|
| 44 |
+
print("β
Pip upgraded successfully")
|
| 45 |
+
except Exception as e:
|
| 46 |
+
print(f"β Error upgrading pip: {e}")
|
| 47 |
+
sys.exit(1)
|
| 48 |
+
|
| 49 |
+
# Step 3: Install requirements for Streamlit (UI application)
|
| 50 |
+
print()
|
| 51 |
+
print("Step 3: Installing Streamlit and dependencies...")
|
| 52 |
+
streamlit_requirements = [
|
| 53 |
+
"streamlit>=1.28.0",
|
| 54 |
+
"transformers>=4.36.0",
|
| 55 |
+
"pillow>=10.0.0",
|
| 56 |
+
"torch>=2.0.0", # CPU-only PyTorch
|
| 57 |
+
]
|
| 58 |
+
|
| 59 |
+
# Install torch from CPU index first
|
| 60 |
+
print(" - Installing PyTorch (CPU version)...")
|
| 61 |
+
try:
|
| 62 |
+
subprocess.check_call([
|
| 63 |
+
str(pip_exe), "install",
|
| 64 |
+
"--index-url", "https://download.pytorch.org/whl/cpu",
|
| 65 |
+
"torch>=2.0.0"
|
| 66 |
+
])
|
| 67 |
+
print(" β
PyTorch installed")
|
| 68 |
+
except Exception as e:
|
| 69 |
+
print(f" β οΈ Warning installing PyTorch: {e}")
|
| 70 |
+
|
| 71 |
+
# Install other streamlit packages
|
| 72 |
+
print(" - Installing other packages...")
|
| 73 |
+
try:
|
| 74 |
+
subprocess.check_call([str(pip_exe), "install"] + streamlit_requirements[:-1])
|
| 75 |
+
print("β
Streamlit and dependencies installed")
|
| 76 |
+
except Exception as e:
|
| 77 |
+
print(f"β Error installing Streamlit dependencies: {e}")
|
| 78 |
+
sys.exit(1)
|
| 79 |
+
|
| 80 |
+
# Step 4: Install ETL dependencies
|
| 81 |
+
print()
|
| 82 |
+
print("Step 4: Installing ETL dependencies...")
|
| 83 |
+
etl_requirements = [
|
| 84 |
+
"jsonlines>=4.0.0",
|
| 85 |
+
"pandas>=2.0.0",
|
| 86 |
+
]
|
| 87 |
+
try:
|
| 88 |
+
subprocess.check_call([str(pip_exe), "install"] + etl_requirements)
|
| 89 |
+
print("β
ETL dependencies installed")
|
| 90 |
+
except Exception as e:
|
| 91 |
+
print(f"β Error installing ETL dependencies: {e}")
|
| 92 |
+
sys.exit(1)
|
| 93 |
+
|
| 94 |
+
# Step 5: Install Jupyter
|
| 95 |
+
print()
|
| 96 |
+
print("Step 5: Installing Jupyter...")
|
| 97 |
+
try:
|
| 98 |
+
subprocess.check_call([str(pip_exe), "install", "jupyter>=1.0.0"])
|
| 99 |
+
print("β
Jupyter installed")
|
| 100 |
+
except Exception as e:
|
| 101 |
+
print(f"β Error installing Jupyter: {e}")
|
| 102 |
+
sys.exit(1)
|
| 103 |
+
|
| 104 |
+
# Step 6: Create activation scripts info
|
| 105 |
+
print()
|
| 106 |
+
print("=" * 60)
|
| 107 |
+
print("β
Setup Complete!")
|
| 108 |
+
print("=" * 60)
|
| 109 |
+
print()
|
| 110 |
+
print("π To activate the virtual environment, run:")
|
| 111 |
+
print()
|
| 112 |
+
if sys.platform == "win32":
|
| 113 |
+
print(f" {venv_path}\\Scripts\\activate")
|
| 114 |
+
else:
|
| 115 |
+
print(f" source {venv_path}/bin/activate")
|
| 116 |
+
print()
|
| 117 |
+
print("π To start the Streamlit application after activation:")
|
| 118 |
+
print(f" streamlit run {project_path}/containers/streamlit/app.py")
|
| 119 |
+
print()
|
| 120 |
+
print("π To start Jupyter Notebook after activation:")
|
| 121 |
+
print(f" jupyter notebook --notebook-dir={project_path}/volumes/notebooks")
|
| 122 |
+
print()
|
| 123 |
+
print("π§ Or use Docker Compose for containerized services:")
|
| 124 |
+
print(f" cd {project_path}")
|
| 125 |
+
print(" sudo docker compose up -d jupyter streamlit")
|
| 126 |
+
print()
|
| 127 |
+
|
| 128 |
+
if __name__ == "__main__":
|
| 129 |
+
main()
|
start_app.bat
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
REM Prerad Setup and Launch Script for Windows
|
| 3 |
+
REM This script creates a virtual environment and starts the Streamlit application
|
| 4 |
+
|
| 5 |
+
setlocal enabledelayedexpansion
|
| 6 |
+
|
| 7 |
+
set "PROJECT_PATH=C:\Users\YourUsername\prerad"
|
| 8 |
+
set "VENV_PATH=%PROJECT_PATH%\venv"
|
| 9 |
+
|
| 10 |
+
echo ====================================
|
| 11 |
+
echo Prerad Environment Setup and Launch
|
| 12 |
+
echo ====================================
|
| 13 |
+
echo.
|
| 14 |
+
|
| 15 |
+
echo Running setup script...
|
| 16 |
+
python "%PROJECT_PATH%\setup_venv.py"
|
| 17 |
+
|
| 18 |
+
echo.
|
| 19 |
+
echo ====================================
|
| 20 |
+
echo Environment is ready!
|
| 21 |
+
echo ====================================
|
| 22 |
+
echo.
|
| 23 |
+
|
| 24 |
+
echo Activating virtual environment...
|
| 25 |
+
call "%VENV_PATH%\Scripts\activate.bat"
|
| 26 |
+
|
| 27 |
+
echo.
|
| 28 |
+
echo Virtual environment activated
|
| 29 |
+
echo.
|
| 30 |
+
|
| 31 |
+
echo Choose what to start:
|
| 32 |
+
echo 1) Streamlit application (localhost:8501)
|
| 33 |
+
echo 2) Jupyter Notebook (localhost:8888)
|
| 34 |
+
echo 3) Exit
|
| 35 |
+
echo.
|
| 36 |
+
|
| 37 |
+
set /p choice="Enter your choice (1-3): "
|
| 38 |
+
|
| 39 |
+
if "%choice%"=="1" (
|
| 40 |
+
echo.
|
| 41 |
+
echo Starting Streamlit application...
|
| 42 |
+
streamlit run "%PROJECT_PATH%\containers\streamlit\app.py"
|
| 43 |
+
) else if "%choice%"=="2" (
|
| 44 |
+
echo.
|
| 45 |
+
echo Starting Jupyter Notebook...
|
| 46 |
+
jupyter notebook --notebook-dir="%PROJECT_PATH%\volumes\notebooks"
|
| 47 |
+
) else if "%choice%"=="3" (
|
| 48 |
+
echo Exiting...
|
| 49 |
+
exit /b 0
|
| 50 |
+
) else (
|
| 51 |
+
echo Invalid choice. Exiting...
|
| 52 |
+
exit /b 1
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
endlocal
|
start_app.sh
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Prerad Setup and Launch Script
|
| 3 |
+
# This script creates a virtual environment and starts the Streamlit application
|
| 4 |
+
|
| 5 |
+
set -e
|
| 6 |
+
|
| 7 |
+
PROJECT_PATH="/run/media/dheena/Leave you files/prerad"
|
| 8 |
+
VENV_PATH="${PROJECT_PATH}/venv"
|
| 9 |
+
|
| 10 |
+
echo "π― Prerad Environment Setup and Launch"
|
| 11 |
+
echo "======================================"
|
| 12 |
+
echo ""
|
| 13 |
+
|
| 14 |
+
# Run Python setup script
|
| 15 |
+
echo "Running setup script..."
|
| 16 |
+
python3 "${PROJECT_PATH}/setup_venv.py"
|
| 17 |
+
|
| 18 |
+
echo ""
|
| 19 |
+
echo "======================================"
|
| 20 |
+
echo "π Environment is ready!"
|
| 21 |
+
echo "======================================"
|
| 22 |
+
echo ""
|
| 23 |
+
|
| 24 |
+
# Activate virtual environment
|
| 25 |
+
echo "Activating virtual environment..."
|
| 26 |
+
source "${VENV_PATH}/bin/activate"
|
| 27 |
+
|
| 28 |
+
echo ""
|
| 29 |
+
echo "β
Virtual environment activated"
|
| 30 |
+
echo ""
|
| 31 |
+
|
| 32 |
+
# Offer options to start services
|
| 33 |
+
echo "Choose what to start:"
|
| 34 |
+
echo "1) Streamlit application (localhost:8501)"
|
| 35 |
+
echo "2) Jupyter Notebook (localhost:8888)"
|
| 36 |
+
echo "3) Both (using Docker Compose with sudo)"
|
| 37 |
+
echo "4) Exit"
|
| 38 |
+
echo ""
|
| 39 |
+
read -p "Enter your choice (1-4): " choice
|
| 40 |
+
|
| 41 |
+
case $choice in
|
| 42 |
+
1)
|
| 43 |
+
echo ""
|
| 44 |
+
echo "π Starting Streamlit application..."
|
| 45 |
+
streamlit run "${PROJECT_PATH}/containers/streamlit/app.py"
|
| 46 |
+
;;
|
| 47 |
+
2)
|
| 48 |
+
echo ""
|
| 49 |
+
echo "π Starting Jupyter Notebook..."
|
| 50 |
+
jupyter notebook --notebook-dir="${PROJECT_PATH}/volumes/notebooks"
|
| 51 |
+
;;
|
| 52 |
+
3)
|
| 53 |
+
echo ""
|
| 54 |
+
echo "π³ Starting services with Docker Compose..."
|
| 55 |
+
cd "${PROJECT_PATH}"
|
| 56 |
+
sudo docker compose up -d jupyter streamlit
|
| 57 |
+
echo ""
|
| 58 |
+
echo "β
Services started!"
|
| 59 |
+
echo " Jupyter: http://localhost:8888"
|
| 60 |
+
echo " Streamlit: http://localhost:8501"
|
| 61 |
+
;;
|
| 62 |
+
4)
|
| 63 |
+
echo "Exiting..."
|
| 64 |
+
exit 0
|
| 65 |
+
;;
|
| 66 |
+
*)
|
| 67 |
+
echo "Invalid choice. Exiting..."
|
| 68 |
+
exit 1
|
| 69 |
+
;;
|
| 70 |
+
esac
|
streamlit_app.py
ADDED
|
File without changes
|