Script pour exécuter localement

This commit is contained in:
François Pelletier 2024-11-03 23:12:19 -05:00
parent b077e7a7ee
commit cae227e7ea

41
run_app.sh Normal file
View file

@ -0,0 +1,41 @@
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Check if Python is installed
if ! command -v python3 &> /dev/null
then
echo "Python3 could not be found. Please install Python 3.7 or newer."
exit 1
fi
# Check if virtualenv is installed
if ! command -v virtualenv &> /dev/null
then
echo "virtualenv could not be found. Installing virtualenv..."
pip3 install virtualenv
fi
# Create a virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
fi
# Activate the virtual environment
source venv/bin/activate
# Install or upgrade pip
pip install --upgrade pip
# Install the required packages
echo "Installing required packages..."
pip install -r requirements.txt
# Run the Streamlit app
echo "Starting the Streamlit app..."
streamlit run app.py
# Deactivate the virtual environment
deactivate