File size: 2,288 Bytes
9679fcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# GraphWiz Ireland - One-Stop Setup Script
# Works with both UV and pip automatically

set -e

echo "=================================="
echo "  GraphWiz Ireland - Setup"
echo "=================================="
echo ""

# Check if UV is available
if command -v uv &> /dev/null; then
    USE_UV=true
    echo "βœ“ Using UV package manager (fast!)"
else
    USE_UV=false
    echo "βœ“ Using pip"
fi

# Check Python version
python_version=$(python3 --version 2>&1 | awk '{print $2}')
echo "βœ“ Python $python_version"

# Determine venv directory
if [ "$USE_UV" = true ]; then
    VENV_DIR=".venv"
else
    VENV_DIR="venv"
fi

# Create venv if needed
if [ ! -d "$VENV_DIR" ]; then
    echo "β†’ Creating virtual environment..."
    if [ "$USE_UV" = true ]; then
        uv venv
    else
        python3 -m venv venv
    fi
    echo "βœ“ Virtual environment created"
else
    echo "βœ“ Virtual environment exists"
fi

# Activate venv
echo "β†’ Activating virtual environment..."
source $VENV_DIR/bin/activate

# Install dependencies
echo "β†’ Installing dependencies..."
if [ "$USE_UV" = true ]; then
    uv pip install -r requirements.txt -q
else
    pip install -q --upgrade pip
    pip install -q -r requirements.txt
fi
echo "βœ“ Dependencies installed"

# Download spaCy model
echo "β†’ Downloading spaCy model..."
if [ "$USE_UV" = true ]; then
    uv pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1-py3-none-any.whl -q
else
    python -m spacy download en_core_web_sm --quiet 2>/dev/null || python -m spacy download en_core_web_sm
fi
echo "βœ“ spaCy model ready"

# Setup .env
if [ ! -f ".env" ]; then
    cp .env.example .env
    echo "βœ“ .env file created"
fi

# Create directories
mkdir -p dataset/wikipedia_ireland
echo "βœ“ Data directories ready"

# Test imports
echo "β†’ Testing installation..."
python -c "import streamlit, groq, faiss, spacy, networkx; print('βœ“ All packages working')"

echo ""
echo "=================================="
echo "βœ… Setup Complete!"
echo "=================================="
echo ""
echo "Next steps:"
echo "1. Set GROQ_API_KEY in .env (already done)"
echo "2. Build knowledge base: python build_graphwiz.py"
echo "3. Launch app: streamlit run src/app.py"
echo ""