fix: update default settings and local model guide (#156)
This commit is contained in:
committed by
GitHub
parent
4b2b334d2c
commit
9354ad8241
@@ -74,7 +74,7 @@ function activate_conda_env() {
|
||||
|
||||
source "$conda_root/etc/profile.d/conda.sh" # conda init
|
||||
conda activate "$env_dir" || {
|
||||
echo "Failed to activate environment. Please remove $env_dir and run the installer again"
|
||||
echo "Failed to activate environment. Please remove $env_dir and run the installer again."
|
||||
exit 1
|
||||
}
|
||||
echo "Activate conda environment at $CONDA_PREFIX"
|
||||
@@ -143,6 +143,32 @@ function setup_local_model() {
|
||||
python $(pwd)/scripts/serve_local.py
|
||||
}
|
||||
|
||||
function download_and_unzip() {
|
||||
local url=$1
|
||||
local dest_dir=$2
|
||||
|
||||
# Check if the destination directory exists, create if it doesn't
|
||||
if [ -d "$dest_dir" ]; then
|
||||
echo "Destination directory $dest_dir already exists. Skipping download."
|
||||
return
|
||||
fi
|
||||
|
||||
mkdir -p "$dest_dir"
|
||||
|
||||
# Download the ZIP file
|
||||
local zip_file="${dest_dir}/downloaded.zip"
|
||||
echo "Downloading $url to $zip_file"
|
||||
curl -L -o "$zip_file" "$url"
|
||||
|
||||
# Unzip the file to the destination directory
|
||||
echo "Unzipping $zip_file to $dest_dir"
|
||||
unzip -o "$zip_file" -d "$dest_dir"
|
||||
|
||||
# Clean up the downloaded ZIP file
|
||||
rm "$zip_file"
|
||||
echo "Download and unzip completed successfully."
|
||||
}
|
||||
|
||||
function launch_ui() {
|
||||
python $(pwd)/app.py || {
|
||||
echo "" && echo "Will exit now..."
|
||||
@@ -167,6 +193,11 @@ conda_root="${install_dir}/conda"
|
||||
env_dir="${install_dir}/env"
|
||||
python_version="3.10"
|
||||
|
||||
pdf_js_version="4.0.379"
|
||||
pdf_js_dist_name="pdfjs-${pdf_js_version}-dist"
|
||||
pdf_js_dist_url="https://github.com/mozilla/pdf.js/releases/download/v${pdf_js_version}/${pdf_js_dist_name}.zip"
|
||||
target_pdf_js_dir="$(pwd)/libs/ktem/ktem/assets/prebuilt/${pdf_js_dist_name}"
|
||||
|
||||
check_path_for_spaces
|
||||
|
||||
print_highlight "Setting up Miniconda"
|
||||
@@ -179,6 +210,9 @@ activate_conda_env
|
||||
print_highlight "Installing requirements"
|
||||
install_dependencies
|
||||
|
||||
print_highlight "Downloading and unzipping PDF.js"
|
||||
download_and_unzip $pdf_js_dist_url $target_pdf_js_dir
|
||||
|
||||
print_highlight "Setting up a local model"
|
||||
setup_local_model
|
||||
|
||||
|
Reference in New Issue
Block a user