-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsetup-label-studio.sh
More file actions
36 lines (31 loc) · 1.26 KB
/
Copy pathsetup-label-studio.sh
File metadata and controls
36 lines (31 loc) · 1.26 KB
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
30
31
32
33
34
35
36
#!/bin/bash
# Copyright (C) 2024 shmilee
studio_path=~/label-studio
PYTHON_VERSION=3.12.12
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - zsh)"
if ! pyenv versions | grep $PYTHON_VERSION 2>&1 >/dev/null; then
pyenv install $PYTHON_VERSION || exit 12
fi
pyenv shell $PYTHON_VERSION
# install for ~user
python3 -m venv "$studio_path" --prompt LABEL
sed -e "/PS1=.*(LABEL)/ s/PS1/#PS1/" \
-e "/PS1=.*(LABEL)/a\ PS1=\"\$(echo \"\${PS1:-}\" \| sed 's\|^\|(LABEL)\|g')\"" \
-i $studio_path/bin/activate
source "$studio_path/bin/activate"
python3 -m pip install label-studio
echo "export LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true" >> "$studio_path/bin/activate"
echo "export LABEL_STUDIO_BASE_DATA_DIR=$studio_path/data" >> "$studio_path/bin/activate"
mkdir "$studio_path/data"
# add localhost usernames
for i in `seq 1 10`; do
who="$(tr -dc a-z </dev/urandom | head -c 5)@localhost"
key="pWd+$(cat /proc/sys/kernel/random/uuid | cut -d- -f3)$(tr -dc A-Za-z0-9 </dev/urandom | head -c 8)"
echo -e "$i $who $key\n" >> "$studio_path/user-info"
label-studio start -b --username "$who" --password "$key"
done
# check
#label-studio user --username ?name?from?user-info?
#label-studio start