Spaces:
Running
Running
# Script to start the Educational LLM Application | |
# Color definitions | |
GREEN='\033[0;32m' | |
YELLOW='\033[1;33m' | |
NC='\033[0m' # No Color | |
# Welcome message | |
echo -e "${GREEN}=== Educational LLM Application Startup Script ===${NC}" | |
echo -e "${YELLOW}Setting up environment...${NC}" | |
# Check Python3 exists | |
if ! command -v python3 &> /dev/null; then | |
echo "Error: Python3 not found. Please install Python3 first." | |
exit 1 | |
fi | |
# Create virtual environment (if it doesn't exist) | |
if [ ! -d "venv" ]; then | |
echo -e "${YELLOW}Creating virtual environment...${NC}" | |
python3 -m venv venv | |
if [ $? -ne 0 ]; then | |
echo "Error: Unable to create virtual environment. Please check your Python installation." | |
exit 1 | |
fi | |
fi | |
# Activate virtual environment | |
echo -e "${YELLOW}Activating virtual environment...${NC}" | |
source venv/bin/activate | |
if [ $? -ne 0 ]; then | |
echo "Error: Unable to activate virtual environment." | |
exit 1 | |
fi | |
# Check requirements.txt and install dependencies | |
echo -e "${YELLOW}Installing dependencies...${NC}" | |
pip install -r requirements.txt | |
if [ $? -ne 0 ]; then | |
echo "Error: Unable to install dependencies. Please check your network connection and requirements.txt file." | |
exit 1 | |
fi | |
# Ensure cache directory exists | |
echo -e "${YELLOW}Creating cache directory...${NC}" | |
mkdir -p cache | |
# Start application | |
echo -e "${GREEN}Starting Educational LLM Application...${NC}" | |
echo -e "${YELLOW}The application will open in your browser${NC}" | |
python app.py | |
# Exit virtual environment | |
deactivate |