Hệ thống xử lý âm thanh thành văn bản và tóm tắt nội dung, chạy hoàn toàn offline với khả năng xử lý đa luồng và quản lý tác vụ.
[Frontend Layer]
├── React + TypeScript
├── Material-UI
├── WebSocket Client
├── Speaker Diarization Option (UI)
↓
[API Layer]
├── FastAPI
├── WebSocket Server
├── REST Endpoints
├── Nhận options: bật/tắt diarization, chọn giải pháp (NeMo/WhisperX)
↓
[Task Queue Layer]
├── Celery
├── Redis
└── Worker Pool
↓
[Processing Layer]
├── Audio Processing Workers
├── Speech-to-Text Workers
├── Speaker Diarization Pipeline (modular: NeMo/WhisperX/None)
├── Summarization Workers
↓
[Storage Layer]
├── PostgreSQL
└── File Storage
git clone https://github.com/your-username/speech-to-information.git
cd speech-to-information
Tạo và kích hoạt môi trường ảo:
python -m venv venv
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
Cài đặt dependencies:
pip install -r requirements.txt
cd frontend
npm install
# Cài đặt PostgreSQL
# Windows: https://www.postgresql.org/download/windows/
# Linux: sudo apt-get install postgresql
# Mac: brew install postgresql
# Cài đặt Redis
# Windows: https://github.com/microsoftarchive/redis/releases
# Linux: sudo apt-get install redis-server
# Mac: brew install redis
.env từ .env.examplepython scripts/init_db.py
# Windows
redis-server
# Linux/Mac
sudo service redis-server start
celery -A src.worker worker --loglevel=info
uvicorn src.main:app --reload
cd frontend
npm run dev
Truy cập http://localhost:3000 để sử dụng hệ thống.
Upload Files:
Tùy chọn Speaker Diarization (Phân biệt người nói):
Xử lý:
Theo dõi:
Kết quả:
API documentation có sẵn tại http://localhost:8000/docs sau khi khởi động backend.
Mọi đóng góp đều được hoan nghênh! Vui lòng đọc CONTRIBUTING.md để biết thêm chi tiết.
MIT License
Dự án FastAPI chuyển đổi giọng nói thành văn bản và tóm tắt nội dung, hỗ trợ upload audio, batch, quản lý task, lấy kết quả.
python -m venv venv
venv\Scripts\activate # Windows
pip install -r requirements.txt
Tạo file .env ở thư mục gốc với nội dung mẫu:
SECRET_KEY=your-super-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/speech_to_info
DATABASE_TEST_URL=postgresql://postgres:postgres@localhost:5432/speech_to_info_test
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
REDIS_PASSWORD=
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0
WHISPER_MODEL=large-v2
VOSK_MODEL_PATH=models/vosk-model-vn-0.4
T5_MODEL_PATH=models/t5-base
UPLOAD_DIR=uploads
MAX_UPLOAD_SIZE=100000000
ALLOWED_EXTENSIONS=["wav", "mp3", "m4a", "ogg"]
LOG_LEVEL=INFO
LOG_FILE=logs/app.log
LOKI_URL=http://localhost:3100
FRONTEND_URL=http://localhost:3000
CORS_ORIGINS=["http://localhost:3000", "http://localhost:8000"]
API_V1_STR=/api/v1
PROJECT_NAME=Speech to Information
BACKEND_CORS_ORIGINS=["http://localhost:3000", "http://localhost:8000"]
PROMETHEUS_MULTIPROC_DIR=/tmp/prometheus_multiproc
METRICS_PORT=9090
pytest tests/test_system.py -v
uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload
Truy cập http://localhost:8000/docs để thử các endpoint.
GET /api/health: Kiểm tra trạng thái serverPOST /api/audio/upload: Upload 1 file audioPOST /api/audio/batch: Upload nhiều file audioPOST /api/tasks: Tạo task xử lýGET /api/tasks/{task_id}: Lấy trạng thái taskGET /api/results/{task_id}: Lấy kết quả tasksrc/services/.docker-compose.yml.| Giải pháp | Độ chính xác | Yêu cầu phần cứng | Dễ tích hợp | Offline |
|---|---|---|---|---|
| NeMo | Rất cao | GPU mạnh (NVIDIA) | Trung bình | Có |
| WhisperX | Tốt | CPU/GPU | Rất dễ | Có |
src/core/config.py:
WHISPER_DEVICE, WHISPER_COMPUTE_TYPE, WHISPER_BATCH_SIZE, WHISPER_BEAM_SIZEWHISPER_DEVICE=cuda WHISPER_COMPUTE_TYPE=float16 WHISPER_BATCH_SIZE=16 WHISPER_BEAM_SIZE=1 python ...celery -A src.worker.worker worker --loglevel=info
celery -A src.worker.worker worker --loglevel=info --pool=solo
uvicorn src.main:app --reload
celery -A src.worker.worker worker --loglevel=info --pool=threads
npm run dev
Hệ thống xử lý âm thanh thành văn bản và tóm tắt nội dung, chạy hoàn toàn offline với khả năng xử lý đa luồng và quản lý tác vụ.
[Frontend Layer]
├── React + TypeScript
├── Material-UI
├── WebSocket Client
├── Speaker Diarization Option (UI)
↓
[API Layer]
├── FastAPI
├── WebSocket Server
├── REST Endpoints
├── Nhận options: bật/tắt diarization, chọn giải pháp (NeMo/WhisperX)
↓
[Task Queue Layer]
├── Celery
├── Redis
└── Worker Pool
↓
[Processing Layer]
├── Audio Processing Workers
├── Speech-to-Text Workers
├── Speaker Diarization Pipeline (modular: NeMo/WhisperX/None)
├── Summarization Workers
↓
[Storage Layer]
├── PostgreSQL
└── File Storage
git clone https://github.com/your-username/speech-to-information.git
cd speech-to-information
Tạo và kích hoạt môi trường ảo:
python -m venv venv
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
Cài đặt dependencies:
pip install -r requirements.txt
cd frontend
npm install
# Cài đặt PostgreSQL
# Windows: https://www.postgresql.org/download/windows/
# Linux: sudo apt-get install postgresql
# Mac: brew install postgresql
# Cài đặt Redis
# Windows: https://github.com/microsoftarchive/redis/releases
# Linux: sudo apt-get install redis-server
# Mac: brew install redis
.env từ .env.examplepython scripts/init_db.py
# Windows
redis-server
# Linux/Mac
sudo service redis-server start
celery -A src.worker worker --loglevel=info
uvicorn src.main:app --reload
cd frontend
npm run dev
Truy cập http://localhost:3000 để sử dụng hệ thống.
Upload Files:
Tùy chọn Speaker Diarization (Phân biệt người nói):
Xử lý:
Theo dõi:
Kết quả:
API documentation có sẵn tại http://localhost:8000/docs sau khi khởi động backend.
Mọi đóng góp đều được hoan nghênh! Vui lòng đọc CONTRIBUTING.md để biết thêm chi tiết.
MIT License
Dự án FastAPI chuyển đổi giọng nói thành văn bản và tóm tắt nội dung, hỗ trợ upload audio, batch, quản lý task, lấy kết quả.
python -m venv venv
venv\Scripts\activate # Windows
pip install -r requirements.txt
Tạo file .env ở thư mục gốc với nội dung mẫu:
SECRET_KEY=your-super-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/speech_to_info
DATABASE_TEST_URL=postgresql://postgres:postgres@localhost:5432/speech_to_info_test
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
REDIS_PASSWORD=
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0
WHISPER_MODEL=large-v2
VOSK_MODEL_PATH=models/vosk-model-vn-0.4
T5_MODEL_PATH=models/t5-base
UPLOAD_DIR=uploads
MAX_UPLOAD_SIZE=100000000
ALLOWED_EXTENSIONS=["wav", "mp3", "m4a", "ogg"]
LOG_LEVEL=INFO
LOG_FILE=logs/app.log
LOKI_URL=http://localhost:3100
FRONTEND_URL=http://localhost:3000
CORS_ORIGINS=["http://localhost:3000", "http://localhost:8000"]
API_V1_STR=/api/v1
PROJECT_NAME=Speech to Information
BACKEND_CORS_ORIGINS=["http://localhost:3000", "http://localhost:8000"]
PROMETHEUS_MULTIPROC_DIR=/tmp/prometheus_multiproc
METRICS_PORT=9090
pytest tests/test_system.py -v
uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload
Truy cập http://localhost:8000/docs để thử các endpoint.
GET /api/health: Kiểm tra trạng thái serverPOST /api/audio/upload: Upload 1 file audioPOST /api/audio/batch: Upload nhiều file audioPOST /api/tasks: Tạo task xử lýGET /api/tasks/{task_id}: Lấy trạng thái taskGET /api/results/{task_id}: Lấy kết quả tasksrc/services/.docker-compose.yml.| Giải pháp | Độ chính xác | Yêu cầu phần cứng | Dễ tích hợp | Offline |
|---|---|---|---|---|
| NeMo | Rất cao | GPU mạnh (NVIDIA) | Trung bình | Có |
| WhisperX | Tốt | CPU/GPU | Rất dễ | Có |
src/core/config.py:
WHISPER_DEVICE, WHISPER_COMPUTE_TYPE, WHISPER_BATCH_SIZE, WHISPER_BEAM_SIZEWHISPER_DEVICE=cuda WHISPER_COMPUTE_TYPE=float16 WHISPER_BATCH_SIZE=16 WHISPER_BEAM_SIZE=1 python ...celery -A src.worker.worker worker --loglevel=info
celery -A src.worker.worker worker --loglevel=info --pool=solo
uvicorn src.main:app --reload
celery -A src.worker.worker worker --loglevel=info --pool=threads
npm run dev