An end-to-end AI application that allows users to record their voice and get real-time transcriptions. This project combines deep learning (Wav2Vec2), a FastAPI backend, a Streamlit frontend, a PostgreSQL database, and full Dockerized deployment.
Users can:
- Record audio directly from the browser
- Get an AI transcription of their speech
- View transcription history stored in the database
- Record — User records audio from the Streamlit UI
- Upload — Frontend sends the audio file to the backend via
POST /transcribe - Transcribe — Backend loads the
.wavfile, runs it through the Wav2Vec2 model (Hugging Face), and converts the waveform to text - Store — Transcription is saved to PostgreSQL
- Display — Transcribed text is returned and shown in the UI
- History — Past transcriptions are retrieved via
GET /history
| Layer | Technology |
|---|---|
| Backend | FastAPI, Hugging Face Transformers, PyTorch, psycopg2 |
| Frontend | Streamlit |
| Database | PostgreSQL |
| DevOps | Docker, Docker Compose, AWS EC2, GitHub Actions |
speech_to_text/
│
├── backend/
│ ├── main.py
│ ├── model.py
│ ├── db.py
│ └── requirements.txt
│
├── frontend/
│ ├── app.py
│ └── requirements.txt
│
├── docker-compose.yml
└── README.md
git clone https://github.com/moecrosoft/speech_to_text.git
cd speech_to_text
docker-compose up -d --buildThis starts:
- Frontend → http://localhost:8501
- Backend → http://localhost:8000
- PostgreSQL database
Request:
{ "file": "audio.wav" }Response:
{ "text": "hello world" }Response:
["hello world", "this is a test transcription"]| Property | Value |
|---|---|
| Model | facebook/wav2vec2-base-960h |
| Input | 16kHz audio waveform |
| Output | Transcribed text |
| Framework | PyTorch |
| Processor | Wav2Vec2Processor |
| Decoding | Greedy decoding (torch.argmax) |
- ✅ Real-time speech-to-text transcription
- ✅ Audio recording in the browser
- ✅ Transcription history tracking
- ✅ Fully Dockerized deployment
- ✅ One-command startup