Update start_server.sh
Browse files- start_server.sh +37 -9
start_server.sh
CHANGED
|
@@ -3,12 +3,13 @@ JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
|
|
| 3 |
|
| 4 |
# Define directories
|
| 5 |
NOTEBOOK_DIR="/data"
|
| 6 |
-
ORIGINAL_NOTEBOOKS="/home/user/app/notebooks" #
|
|
|
|
| 7 |
|
| 8 |
-
echo "Starting notebook setup process..."
|
| 9 |
-
echo "Looking for notebooks in: $ORIGINAL_NOTEBOOKS"
|
| 10 |
|
| 11 |
-
#
|
|
|
|
| 12 |
find "$ORIGINAL_NOTEBOOKS" -name "*.ipynb" -type f 2>/dev/null || echo "Cannot find notebooks in $ORIGINAL_NOTEBOOKS"
|
| 13 |
|
| 14 |
# Check if we can find the notebooks
|
|
@@ -22,18 +23,45 @@ if ls "$ORIGINAL_NOTEBOOKS"/*.ipynb 1> /dev/null 2>&1; then
|
|
| 22 |
|
| 23 |
# Copy notebooks to data directory
|
| 24 |
cp -v "$ORIGINAL_NOTEBOOKS"/*.ipynb "$NOTEBOOK_DIR/" || echo "Failed to copy notebooks"
|
| 25 |
-
|
| 26 |
-
# Set proper permissions
|
| 27 |
-
chmod -R 755 "$NOTEBOOK_DIR"
|
| 28 |
-
chown -R $(whoami) "$NOTEBOOK_DIR" 2>/dev/null || echo "Could not change ownership"
|
| 29 |
else
|
| 30 |
echo "No notebooks found in expected location. Checking all directories..."
|
| 31 |
-
find / -name "*.ipynb" -not -path "*/\.*" 2>/dev/null | head -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
fi
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
# Show what we've got
|
| 35 |
echo "Contents of notebook directory ($NOTEBOOK_DIR):"
|
| 36 |
ls -la "$NOTEBOOK_DIR"
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# Start JupyterLab
|
| 39 |
echo "Starting JupyterLab..."
|
|
|
|
| 3 |
|
| 4 |
# Define directories
|
| 5 |
NOTEBOOK_DIR="/data"
|
| 6 |
+
ORIGINAL_NOTEBOOKS="/home/user/app/notebooks" # Path where notebooks are located
|
| 7 |
+
ORIGINAL_IMAGES="/home/user/app/notebooks/images" # Path where images are located
|
| 8 |
|
| 9 |
+
echo "Starting notebook and images setup process..."
|
|
|
|
| 10 |
|
| 11 |
+
# Set up notebooks
|
| 12 |
+
echo "Looking for notebooks in: $ORIGINAL_NOTEBOOKS"
|
| 13 |
find "$ORIGINAL_NOTEBOOKS" -name "*.ipynb" -type f 2>/dev/null || echo "Cannot find notebooks in $ORIGINAL_NOTEBOOKS"
|
| 14 |
|
| 15 |
# Check if we can find the notebooks
|
|
|
|
| 23 |
|
| 24 |
# Copy notebooks to data directory
|
| 25 |
cp -v "$ORIGINAL_NOTEBOOKS"/*.ipynb "$NOTEBOOK_DIR/" || echo "Failed to copy notebooks"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
else
|
| 27 |
echo "No notebooks found in expected location. Checking all directories..."
|
| 28 |
+
find / -name "*.ipynb" -not -path "*/\.*" 2>/dev/null | head -10
|
| 29 |
+
fi
|
| 30 |
+
|
| 31 |
+
# Set up images directory
|
| 32 |
+
echo "Looking for images in: $ORIGINAL_IMAGES"
|
| 33 |
+
IMAGES_DIR="$NOTEBOOK_DIR/images"
|
| 34 |
+
|
| 35 |
+
# Create images directory in data
|
| 36 |
+
mkdir -p "$IMAGES_DIR"
|
| 37 |
+
rm -f "$IMAGES_DIR"/*.png "$IMAGES_DIR"/*.jpg "$IMAGES_DIR"/*.jpeg "$IMAGES_DIR"/*.gif
|
| 38 |
+
|
| 39 |
+
# Check if original images directory exists
|
| 40 |
+
if [ -d "$ORIGINAL_IMAGES" ]; then
|
| 41 |
+
echo "Found images directory at $ORIGINAL_IMAGES"
|
| 42 |
+
|
| 43 |
+
# Copy all image files to the images directory in data
|
| 44 |
+
find "$ORIGINAL_IMAGES" -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif" \) -exec cp -v {} "$IMAGES_DIR/" \; || echo "Failed to copy images"
|
| 45 |
+
else
|
| 46 |
+
echo "No images directory found at $ORIGINAL_IMAGES. Checking alternatives..."
|
| 47 |
+
# Try to find images in other possible locations
|
| 48 |
+
if [ -d "/home/user/app/images" ]; then
|
| 49 |
+
echo "Found images in /home/user/app/images"
|
| 50 |
+
find "/home/user/app/images" -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif" \) -exec cp -v {} "$IMAGES_DIR/" \; || echo "Failed to copy images"
|
| 51 |
+
else
|
| 52 |
+
echo "No images directory found. Creating an empty one."
|
| 53 |
+
fi
|
| 54 |
fi
|
| 55 |
|
| 56 |
+
# Set proper permissions
|
| 57 |
+
chmod -R 755 "$NOTEBOOK_DIR"
|
| 58 |
+
chown -R $(whoami) "$NOTEBOOK_DIR" 2>/dev/null || echo "Could not change ownership"
|
| 59 |
+
|
| 60 |
# Show what we've got
|
| 61 |
echo "Contents of notebook directory ($NOTEBOOK_DIR):"
|
| 62 |
ls -la "$NOTEBOOK_DIR"
|
| 63 |
+
echo "Contents of images directory ($IMAGES_DIR):"
|
| 64 |
+
ls -la "$IMAGES_DIR"
|
| 65 |
|
| 66 |
# Start JupyterLab
|
| 67 |
echo "Starting JupyterLab..."
|