| echo "" | |
| echo "==========================================" | |
| echo " Restaurant Review Analyzer (ABSA)" | |
| echo "==========================================" | |
| echo "" | |
| # Check if Python is installed | |
| if ! command -v python3 &> /dev/null && ! command -v python &> /dev/null; then | |
| echo "Error: Python is not installed" | |
| echo "Please install Python 3.8+ and try again" | |
| exit 1 | |
| fi | |
| # Use python3 if available, otherwise python | |
| PYTHON_CMD="python3" | |
| if ! command -v python3 &> /dev/null; then | |
| PYTHON_CMD="python" | |
| fi | |
| # Check Python version | |
| PYTHON_VERSION=$($PYTHON_CMD --version 2>&1 | awk '{print $2}') | |
| echo "Using Python $PYTHON_VERSION" | |
| # Check if requirements are installed | |
| echo "Checking dependencies..." | |
| $PYTHON_CMD -c "import gradio, transformers, pandas" 2>/dev/null | |
| if [ $? -ne 0 ]; then | |
| echo "Installing requirements..." | |
| pip install -r requirements.txt | |
| if [ $? -ne 0 ]; then | |
| echo "Error: Failed to install requirements" | |
| echo "You may need to use pip3 instead of pip" | |
| exit 1 | |
| fi | |
| fi | |
| echo "" | |
| echo "Starting the application..." | |
| echo "This may take a few minutes on first run (downloading models)" | |
| echo "" | |
| # Launch the application | |
| $PYTHON_CMD app.py |