File size: 678 Bytes
520f98d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
set -eu

root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
repo_root=$(CDPATH= cd -- "$root/../.." && pwd)
local_ort_dist="$root/node_modules/onnxruntime-web/dist"
repo_ort_dist="$repo_root/node_modules/.bun/onnxruntime-web@1.27.0/node_modules/onnxruntime-web/dist"

if [ -d "$local_ort_dist" ]; then
	ort_dist="$local_ort_dist"
else
	ort_dist="$repo_ort_dist"
fi

if [ ! -d "$ort_dist" ]; then
	printf '%s\n' "Missing ONNX Runtime Web. Run npm install in $root." >&2
	exit 1
fi

mkdir -p "$root/.cache"
ln -sfn "$ort_dist" "$root/.cache/ort"
cd "$root"
if [ -x .venv/bin/python ]; then
	python=.venv/bin/python
else
	python=python3
fi
exec "$python" serve_browser.py