Create DEPLOYMENT_GUIDE
Browse files- DEPLOYMENT_GUIDE +69 -0
DEPLOYMENT_GUIDE
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Deployment Guide for Voice Recognition Model on Hugging Face
|
| 2 |
+
|
| 3 |
+
This guide explains how to deploy the enhanced voice recognition model using the provided files.
|
| 4 |
+
|
| 5 |
+
## Prerequisites
|
| 6 |
+
|
| 7 |
+
- Docker installed on your system
|
| 8 |
+
- Hugging Face account
|
| 9 |
+
- Hugging Face CLI installed (`pip install huggingface_hub`)
|
| 10 |
+
- API token from Hugging Face
|
| 11 |
+
|
| 12 |
+
## Files Included
|
| 13 |
+
|
| 14 |
+
- `app.py`: FastAPI application serving the model
|
| 15 |
+
- `requirements.txt`: Python dependencies
|
| 16 |
+
- `Dockerfile`: Container configuration
|
| 17 |
+
- `README.md`: Project overview and usage instructions
|
| 18 |
+
|
| 19 |
+
## Steps to Deploy
|
| 20 |
+
|
| 21 |
+
### 1. Build Docker Image
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
docker build -t voice-recognition-app .
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
### 2. Run Docker Container Locally
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
docker run -p 8000:8000 voice-recognition-app
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
The API will be available at `http://localhost:8000`.
|
| 34 |
+
|
| 35 |
+
### 3. Test API Locally
|
| 36 |
+
|
| 37 |
+
Use curl or any HTTP client to test the `/predict` endpoint:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
curl -X POST "http://localhost:8000/predict" -F "file=@path_to_audio_file.wav"
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
### 4. Push to Hugging Face
|
| 44 |
+
|
| 45 |
+
Login to Hugging Face CLI:
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
huggingface-cli login
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Create a new repository on Hugging Face or use an existing one.
|
| 52 |
+
|
| 53 |
+
Push your Docker image or code to Hugging Face Spaces or Model Hub as per your preference.
|
| 54 |
+
|
| 55 |
+
### 5. Monitor and Manage
|
| 56 |
+
|
| 57 |
+
Use the Hugging Face interface to monitor usage, logs, and manage your deployment.
|
| 58 |
+
|
| 59 |
+
## Notes
|
| 60 |
+
|
| 61 |
+
- Ensure your model file `voice_recognition_final_enhanced.pth` is included in the deployment package or accessible by the app.
|
| 62 |
+
- Adjust the `app.py` if you change the model path or architecture.
|
| 63 |
+
- For GPU support, configure your Docker environment accordingly.
|
| 64 |
+
|
| 65 |
+
## References
|
| 66 |
+
|
| 67 |
+
- [FastAPI Documentation](https://fastapi.tiangolo.com/)
|
| 68 |
+
- [Hugging Face Spaces](https://huggingface.co/spaces)
|
| 69 |
+
- [Docker Documentation](https://docs.docker.com/)
|