-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathgenerate.sh
More file actions
executable file
·103 lines (87 loc) · 2.37 KB
/
generate.sh
File metadata and controls
executable file
·103 lines (87 loc) · 2.37 KB
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
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# Quick start script for generating face images
set -e
echo "🎭 Face Looker - Quick Start Generator"
echo "======================================"
echo ""
# Check if REPLICATE_API_TOKEN is set
if [ -z "$REPLICATE_API_TOKEN" ]; then
echo "❌ Error: REPLICATE_API_TOKEN not set!"
echo ""
echo "Please set your Replicate API token:"
echo " export REPLICATE_API_TOKEN=your_token_here"
echo ""
echo "Get your token at: https://replicate.com/account/api-tokens"
exit 1
fi
# Check if virtual environment exists
if [ ! -d ".venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv .venv
fi
# Activate virtual environment
echo "🔌 Activating virtual environment..."
source .venv/bin/activate
# Install dependencies
echo "📥 Installing dependencies..."
pip install -q -r requirements.txt
# Check if image is provided
if [ -z "$1" ]; then
echo "❌ Error: No image provided!"
echo ""
echo "Usage: ./generate.sh <image_path> [output_dir] [step]"
echo ""
echo "Examples:"
echo " ./generate.sh my_face.jpg"
echo " ./generate.sh my_face.jpg ./faces"
echo " ./generate.sh my_face.jpg ./faces 2.5"
exit 1
fi
IMAGE=$1
OUTPUT=${2:-./out}
STEP=${3:-3}
# Check if image exists
if [ ! -f "$IMAGE" ]; then
echo "❌ Error: Image not found: $IMAGE"
exit 1
fi
echo ""
echo "⚙️ Configuration:"
echo " Image: $IMAGE"
echo " Output: $OUTPUT"
echo " Step: $STEP"
echo ""
# Calculate number of images
IMAGES=$(echo "scale=0; ((15 - (-15)) / $STEP + 1) ^ 2" | bc)
echo "📊 Will generate approximately $IMAGES images"
echo ""
# Confirm
read -p "Continue? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Cancelled."
exit 0
fi
# Run generation
echo ""
echo "🚀 Starting generation..."
echo ""
python main.py \
--image "$IMAGE" \
--out "$OUTPUT" \
--step "$STEP" \
--skip-existing
echo ""
echo "✅ Done! Images saved to: $OUTPUT"
echo ""
echo "📋 Next steps:"
echo " 1. Copy faces to your React project:"
echo " cp -r $OUTPUT /path/to/your-react-app/public/faces"
echo ""
echo " 2. Copy React components:"
echo " cp useGazeTracking.js /path/to/your-react-app/src/hooks/"
echo " cp FaceTracker.jsx /path/to/your-react-app/src/components/"
echo ""
echo " 3. Use in your app:"
echo " import FaceTracker from './components/FaceTracker'"
echo ""