From cae227e7ea41f3efaeac00e91e81d6bbd64de9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pelletier?= Date: Sun, 3 Nov 2024 23:12:19 -0500 Subject: [PATCH] =?UTF-8?q?Script=20pour=20ex=C3=A9cuter=20localement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run_app.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 run_app.sh diff --git a/run_app.sh b/run_app.sh new file mode 100644 index 0000000..5aa9ac2 --- /dev/null +++ b/run_app.sh @@ -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 \ No newline at end of file