#!/bin/bash

# Exit on error
set -e

echo "Starting Advanced Agentic System initialization..."

# Create necessary directories
mkdir -p /data/models
mkdir -p logs

# Install system dependencies
apt-get update && apt-get install -y \
    git \
    git-lfs \
    cmake \
    build-essential \
    pkg-config \
    libcurl4-openssl-dev

# Initialize git-lfs
git lfs install

# Upgrade pip and install requirements
python -m pip install --upgrade pip
pip install -r requirements.txt

# Download and initialize models
echo "Initializing models..."
python download_models_space.py

# Start the application
echo "Starting Gradio interface..."
python app.py