This documentation provides an overview and guide for setting up a small ASGI (Asynchronous Server Gateway Interface) Django project for live transcription using modules such as Daphne, Channels, and OpenAI Whisper. The project includes an HTTP index page and a WebSocket route for live translation.
- Python (>=3.6)
- Django (>=3.0)
- Daphne
- Channels
- OpenAI Whisper
- A compatible web browser
-
Clone the project repository from GitHub:
git clone git@github.com:Kyroyen/liveTranscriptionWhisperAPI-.git
-
Install project dependencies using pip:
cd stream pip install -r requirements.txt
-
Set up Django settings:
- Make sure
django.contrib
andchannels
apps are added toINSTALLED_APPS
. - Configure
ASGI_APPLICATION
insettings.py
to point to the ASGI application.
- Make sure
-
Configure Whisper API:
- Obtain Whisper API credentials from OpenAI.
- Store the credentials securely. (e.g., in environment variables)
-
Run the ASGI server using Daphne:
daphne -p 8000 stream.asgi:application
-
Access the index page:
- Open a web browser and navigate to locally :
http://localhost:8000/
; deployment :https://livetranscriptionwhisperapi.onrender.com/
- Open a web browser and navigate to locally :
-
Start the live transcription:
- Click the start transcript button to start, stop to end.
- Alternatively connect to websocket at locally :
ws://localhost:8000/listen
; deployment :wss://livetranscriptionwhisperapi.onrender.com/listen
-
Connect to WebSocket for live translation:
- Utilize the WebSocket route provided by the project to receive live translation updates.
stream/
├── transcript/
│ ├── __init__.py
│ ├── asgi.py
│ ├── consumers.py
│ ├── routing.py
│ ├── templates/
│ │ └── index.html
│ ├── tests.py
│ └── views.py
├── stream/
│ ├── __init__.py
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── .gitignore
├── manage.py
└── requirements.txt
asgi.py
: ASGI application for handling WebSocket connections.consumers.py
: Consumers for WebSocket connections handling live transcription and translation.routing.py
: URL routing for WebSocket connections.templates/index.html
: HTML template for the index page.views.py
: Views for serving HTTP requests.
asgi.py
: ASGI application entry point.settings.py
: Django settings configuration.urls.py
: URL routing for HTTP requests.wsgi.py
: WSGI application entry point.
For any issues or feature requests, please refer to the project's GitHub repository. Contributions via pull requests are welcomed.
This project is licensed under the MIT License.
This project utilizes various open-source libraries and technologies, including Django, Daphne, Channels, and OpenAI Whisper. We express gratitude to the developers and contributors of these projects for their invaluable work.
This project is for demonstration purposes only. Ensure compliance with applicable laws and regulations when using live transcription and translation services.