41 lines
919 B
Bash
41 lines
919 B
Bash
|
#!/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
|