File size: 3,929 Bytes
c759578
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# Urdu S2S MVP Deployment

This is the deployable MVP path for the current Urdu S2S service:

Audio input -> Faster Whisper ASR -> OpenAI Urdu reply -> Devanagari speech text -> Chatterbox Praxy voice output.

## What Is Frozen

- ASR: `faster-whisper`
- Reply model: `OPENAI_MODEL`, default `gpt-4o-mini`
- Speech text: OpenAI-compatible chat client with Urdu-to-Devanagari prompt
- Local policy: Urdu/Hindi wording fixes, abbreviation expansion, gender guardrails
- TTS: `ResembleAI/chatterbox:v3` with Praxy anchor `bench_025.wav`
- Known non-blocking note: `bench_038` can sound like `ya` instead of `ye`

## Required Runtime

Use a CUDA GPU supported by Chatterbox's pinned Torch stack. Good choices:

- RTX 3090 / 3090 Ti
- A10 / A10G
- A100
- L40 / L40S
- H100 / H200

Avoid RTX 50-series and Blackwell RTX PRO machines for this container unless the Torch stack is upgraded, because the current Chatterbox dependency set may not support `sm_120`.

## Environment

Required:

```bash
OPENAI_API_KEY=...
```

Recommended production defaults:

```bash
OPENAI_MODEL=gpt-4o-mini
S2S_DEFAULT_MODE=live_tts
S2S_WHISPER_MODEL=small
S2S_WHISPER_DEVICE=cuda
S2S_WHISPER_COMPUTE_TYPE=float16
S2S_CHATTERBOX_DEVICE=cuda
S2S_PORT=8017
```

CPU/text-only local defaults:

```bash
S2S_DEFAULT_MODE=text_only
S2S_WHISPER_DEVICE=cpu
S2S_WHISPER_COMPUTE_TYPE=int8
```

## Local API

```bash
python3.11 -m venv .venv-deploy
source .venv-deploy/bin/activate
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-api.txt -r requirements-live-s2s.txt

export OPENAI_API_KEY="..."
export OPENAI_MODEL="gpt-4o-mini"
export S2S_DEFAULT_MODE=live_tts
export S2S_WHISPER_MODEL=small
export S2S_WHISPER_DEVICE=cuda
export S2S_WHISPER_COMPUTE_TYPE=float16
export S2S_CHATTERBOX_DEVICE=cuda

PYTHONPATH=src:scripts python scripts/serve_s2s_api.py --host 0.0.0.0 --port 8017
```

Open:

```text
http://127.0.0.1:8017/
```

Health:

```bash
curl http://127.0.0.1:8017/health
```

Live request:

```bash
curl -X POST "http://127.0.0.1:8017/s2s?mode=live_tts&request_id=demo_001" \
  -F "audio=@data/processed/benchmarks/gemini_urdu_s2s_v1/audio_canonical/bench_001.wav"
```

The response includes `tts_audio_url`; fetch it from the same host.

## Docker

Build:

```bash
docker build -t urdu-s2s-mvp:latest .
```

Run on a GPU host:

```bash
docker run --gpus all --rm -p 8017:7860 \
  -e OPENAI_API_KEY="$OPENAI_API_KEY" \
  -e OPENAI_MODEL="gpt-4o-mini" \
  urdu-s2s-mvp:latest
```

Then open:

```text
http://127.0.0.1:8017/
```

## Hugging Face Space

Use a Docker Space with GPU hardware.

Billing prerequisite:

- Personal namespace: Hugging Face Pro is required for Docker Spaces.
- Organization namespace: Team/Enterprise is required for Docker Spaces.
- GPU hardware also requires prepaid credits or billing enabled.

1. Create a new Space.
2. Select SDK: Docker.
3. Push this repo or the deployment bundle.
4. Add secret `OPENAI_API_KEY`.
5. Set GPU hardware.
6. The container listens on port `7860`, which matches Hugging Face's Docker Space default.

## Vast / RunPod

Use a non-Blackwell GPU, preferably RTX 3090/A10/A100/L40S/H100.

Fastest path:

```bash
tar -xzf artifacts/live_s2s_remote_bundle.tar.gz
cd live_s2s_remote_bundle
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-api.txt -r requirements-live-s2s.txt
python -m pip install torchvision==0.21.0

export OPENAI_API_KEY="..."
export S2S_DEFAULT_MODE=live_tts
export S2S_WHISPER_MODEL=small
export S2S_WHISPER_DEVICE=cuda
export S2S_WHISPER_COMPUTE_TYPE=float16
export S2S_CHATTERBOX_DEVICE=cuda

PYTHONPATH=src:scripts python scripts/serve_s2s_api.py --host 0.0.0.0 --port 8017
```

## Next Product Work

- Add auth/rate limits before public launch.
- Add request logging without storing secrets.
- Add a simple queue if concurrent TTS requests pile up.
- Later: run bigger regression batches and fix pronunciation notes.