The backend provides a WebSocket-based audio stream and real-time speech recognition using Google Speech-to-Text.
git clone git@github.com:AI-Smarties/back.gitcd backgit switch devpython3 -m venv venv
source venv/bin/activatepython -m venv venv
.\venv\Scripts\activatepip install -r requirements.txtThe application uses PostgreSQL.
docker compose up -dor
docker-compose up -dThis starts a PostgreSQL container with the correct configuration. You can access the database at localhost:5432.
The application will automatically connect to localhost when running locally (environment variables are not required for local development).
The backend uses Google Cloud Speech-to-Text and the Application Default Credentials (ADC) method.
Do these first in your web browser:
-
Create a Project: Go to Google Cloud Console, create a new project, and copy the Project ID (e.g., smarties-backend-v2).
-
Activate Free Trial: Click the "Activate" banner at the top of the page to claim your free credits.
-
Enable the API: Search for "Cloud Speech-to-Text API" in the top search bar and click Enable.
Run these commands in your terminal:
-
Install GCloud CLI: Download and install here.
-
Enable the API: Search for "Cloud Speech-to-Text API" in the top search bar and click Enable.
gcloud auth application-default login- Link to Project: Run this command (replace [PROJECT_ID] with the ID you copied in Step 1):
gcloud auth application-default set-quota-project [PROJECT_ID]fastapi run src/main.py --host 0.0.0.0When you return to coding, activate the virtual environment and check for updates:
- Start database:
docker-compose up -d(if using Docker Compose) - Activate environment:
source venv/bin/activate - Fetch latest changes:
git pull origin dev - Start server:
fastapi dev src/main.py
src/main.py– FastAPI application and WebSocket endpointsrc/asr.py– Streaming ASR (Google Speech-to-Text)src/db.py– Database connection configurationsrc/models.py– SQLAlchemy database modelsrequirements.txt– Dependenciesdocker-compose.yaml– Local PostgreSQL setupmanifests/– Deployment configurations
Backend is intended to be used with the Flutter frontend