Skip to content

Repository files navigation

3D-Speaker 声纹识别API

基于 3D-Speaker 模型的独立声纹识别服务,提供声纹注册、识别、删除等功能。自有数据库与 voiceprints 表,通过 HTTP API 对外提供能力。

驱动 DB_DRIVER DSN 示例
SQLite sqlite ./voiceprint.db
PostgreSQL postgres host=127.0.0.1 user=postgres password=xxx dbname=voiceprint sslmode=disable
MySQL mysql user:pass@127.0.0.1:3306/voiceprint?charset=utf8mb4

🛠️ 安装和配置

1. 安装依赖

# Python 3.10 虚拟环境
python3.10 -m venv .venv
source .venv/bin/activate

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip install -U pip
pip install -r requirements.txt

# 首次建表(SQLite 示例)
sqlite3 ./voiceprint.db < scripts/schema_sqlite.sql

2. 数据库配置

优先顺序:

  1. 环境变量(推荐)
    export DB_DRIVER=sqlite
    export DSN=./voiceprint.db
  2. data/.voiceprint.yaml 中的 database:
  3. 旧版 mysql: 段(仅 MySQL)

复制示例配置:

mkdir -p data
cp voiceprint.yaml data/.voiceprint.yaml

SQLite 示例(data/.voiceprint.yaml):

database:
  driver: sqlite
  dsn: ./voiceprint.db

PostgreSQL 示例:

database:
  driver: postgres
  dsn: host=127.0.0.1 user=postgres password=secret dbname=voiceprint sslmode=disable

建表脚本:scripts/schema.sql(MySQL)/ scripts/schema_sqlite.sql / scripts/schema_postgres.sql

🚀 启动服务

开发环境

source .venv/bin/activate
export DB_DRIVER=sqlite
export DSN=./voiceprint.db
python -m app.main

生产环境

python start_server.py

📚 API文档

启动服务后:

🖥️ Web 管理端

前端位于 web/(基于 shadcn-admin):

cd web
cp .env.example .env
pnpm install
pnpm dev

浏览器打开 http://localhost:5173 ,在「接口设置」填入与 data/.voiceprint.yaml 一致的 authorization Token。开发环境通过 Vite 代理访问后端 :8005

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages