Update api.py
Browse files
api.py
CHANGED
|
@@ -1,17 +1,18 @@
|
|
| 1 |
-
|
| 2 |
-
import torch
|
| 3 |
-
import soundfile as sf
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
self.model = WhisperForConditionalGeneration.from_pretrained("kingabzpro/whisper-tiny-urdu")
|
| 10 |
-
self.model.to("cpu")
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Custom Urdu Whisper API + UI
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
This Space runs:
|
| 4 |
+
- A custom Flask API (for external apps)
|
| 5 |
+
- A Gradio UI (for manual use)
|
| 6 |
+
- Fully offline model (no HF hosted API)
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
## API Endpoint
|
| 9 |
+
`POST /transcribe`
|
| 10 |
+
|
| 11 |
+
Body:
|
| 12 |
+
- `file`: audio/wav file
|
| 13 |
+
|
| 14 |
+
Response:
|
| 15 |
+
```json
|
| 16 |
+
{
|
| 17 |
+
"text": "urdu transcription here"
|
| 18 |
+
}
|