-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (64 loc) · 2.47 KB
/
Copy pathMakefile
File metadata and controls
74 lines (64 loc) · 2.47 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
.PHONY: setup install-hooks generate clean run test deploy-model setup-android help
# Default target
help:
@echo "SpeakToLearn - Development Commands"
@echo ""
@echo " make setup - Set up Python virtual environment"
@echo " make setup-android - Download ONNX Runtime native libraries for Android"
@echo " make install-hooks - Configure local git hooks"
@echo " make generate - Generate text + audio and export to Flutter"
@echo " make deploy-model - Deploy V4 model to Flutter (auto-detects latest checkpoint)"
@echo " make clean - Remove generated files"
@echo " make run - Run Flutter app"
@echo " make test - Run all tests"
@echo ""
# Configuration
PYTHON := tools/text_gen/.venv/Scripts/python
TEXT_GEN := $(PYTHON) -m text_gen.cli
FLUTTER_ASSETS := apps/mobile_flutter/assets
# Set up Python environment
setup:
cd tools/text_gen && uv venv .venv && uv pip install -e ".[dev]"
@echo ""
@echo "Setup complete. Add your OpenAI API key to tools/text_gen/.env"
# Configure local git hooks
install-hooks:
powershell -ExecutionPolicy Bypass -File scripts/install-hooks.ps1
# Generate content and export to Flutter
generate:
@echo "==> Generating text sequences..."
cd tools/text_gen && $(TEXT_GEN) generate --language zh-CN --count 50 --tags hsk1,daily --difficulty 1
@echo ""
@echo "==> Generating TTS audio..."
cd tools/text_gen && $(TEXT_GEN) audio output/sentences.zh.json --voices female,male
@echo ""
@echo "==> Exporting to Flutter assets..."
cd tools/text_gen && $(TEXT_GEN) export --input output/ --flutter-assets ../../$(FLUTTER_ASSETS)/
@echo ""
@echo "Done! Assets exported to $(FLUTTER_ASSETS)/"
# Clean generated files
clean:
rm -rf tools/text_gen/output/sentences.*.json
rm -rf tools/text_gen/output/examples/
rm -rf $(FLUTTER_ASSETS)/datasets/
rm -rf $(FLUTTER_ASSETS)/examples/
# Run Flutter app
run:
cd apps/mobile_flutter && flutter run
# Deploy V4 model to Flutter
deploy-model:
@echo "==> Deploying V4 model to Flutter..."
cd tools/mandarin_grader && uv run python scripts/deploy_to_flutter.py
@echo ""
@echo "==> Running flutter pub get..."
cd apps/mobile_flutter && flutter pub get
@echo ""
@echo "Done! Model deployed to $(FLUTTER_ASSETS)/models/"
# Download ONNX Runtime native libraries for Android
setup-android:
@echo "==> Downloading ONNX Runtime for Android..."
bash scripts/setup_onnxruntime_android.sh
# Run tests
test:
cd tools/text_gen && $(PYTHON) -m pytest -v
cd apps/mobile_flutter && flutter test