Spaces:
Sleeping
Sleeping
# This script will run after the environment has been built but before the Space is started | |
set -e # Exit immediately if a command fails | |
echo "Starting VERSA installation for Hugging Face Space..." | |
# Set up directory structure | |
echo "Setting up directory structure..." | |
VERSA_ROOT="$(pwd)/versa" | |
DATA_DIR="$(pwd)/data" | |
CONFIG_DIR="${DATA_DIR}/configs" | |
UPLOAD_DIR="${DATA_DIR}/uploads" | |
RESULTS_DIR="${DATA_DIR}/results" | |
mkdir -p "${DATA_DIR}" "${CONFIG_DIR}" "${UPLOAD_DIR}" "${RESULTS_DIR}" | |
# Clone VERSA repository | |
echo "Cloning VERSA repository..." | |
if [ -d "${VERSA_ROOT}" ]; then | |
echo "VERSA directory already exists, updating..." | |
cd "${VERSA_ROOT}" | |
git pull | |
cd .. | |
else | |
echo "Cloning fresh VERSA repository..." | |
git clone https://github.com/shinjiwlab/versa.git "${VERSA_ROOT}" | |
fi | |
# Install VERSA | |
echo "Installing VERSA and dependencies..." | |
cd "${VERSA_ROOT}" | |
pip install -e . | |
# Create a file to indicate successful installation | |
touch "${VERSA_ROOT}/.installation_complete" | |
# Return to the original directory | |
cd .. | |
echo "VERSA installation completed successfully!" | |