davanstrien HF staff commited on
Commit
4692cb2
1 Parent(s): e993973

infer name

Browse files
Files changed (1) hide show
  1. start_server.sh +15 -1
start_server.sh CHANGED
@@ -4,7 +4,21 @@ NOTEBOOK_DIR="/data"
4
 
5
  # Download notebook from URL if provided
6
  if [ -n "$NOTEBOOK_URL" ]; then
7
- wget -O "$NOTEBOOK_DIR/notebook_from_url.ipynb" "$NOTEBOOK_URL"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  fi
9
 
10
  jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
 
4
 
5
  # Download notebook from URL if provided
6
  if [ -n "$NOTEBOOK_URL" ]; then
7
+ # Extract filename from URL
8
+ FILENAME=$(basename "$NOTEBOOK_URL")
9
+
10
+ # Handle GitHub raw URLs
11
+ if [[ "$NOTEBOOK_URL" == *"github.com"* && "$NOTEBOOK_URL" != *"raw.githubusercontent.com"* ]]; then
12
+ # Convert GitHub URL to raw URL
13
+ RAW_URL=$(echo "$NOTEBOOK_URL" | sed 's|github.com|raw.githubusercontent.com|' | sed 's|/blob/|/|')
14
+ wget -O "$NOTEBOOK_DIR/$FILENAME" "$RAW_URL"
15
+ else
16
+ wget -O "$NOTEBOOK_DIR/$FILENAME" "$NOTEBOOK_URL"
17
+ fi
18
+
19
+ echo "Downloaded notebook: $FILENAME"
20
+ else
21
+ echo "No NOTEBOOK_URL provided. Using existing notebooks in the repository."
22
  fi
23
 
24
  jupyter labextension disable "@jupyterlab/apputils-extension:announcements"