Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.ipynb +46 -0
- requirements.txt.txt +3 -0
app.ipynb
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"nbformat": 4,
|
| 3 |
+
"nbformat_minor": 0,
|
| 4 |
+
"metadata": {
|
| 5 |
+
"colab": {
|
| 6 |
+
"provenance": []
|
| 7 |
+
},
|
| 8 |
+
"kernelspec": {
|
| 9 |
+
"name": "python3",
|
| 10 |
+
"display_name": "Python 3"
|
| 11 |
+
},
|
| 12 |
+
"language_info": {
|
| 13 |
+
"name": "python"
|
| 14 |
+
}
|
| 15 |
+
},
|
| 16 |
+
"cells": [
|
| 17 |
+
{
|
| 18 |
+
"cell_type": "code",
|
| 19 |
+
"execution_count": null,
|
| 20 |
+
"metadata": {
|
| 21 |
+
"id": "o2EjqHT7vvJv"
|
| 22 |
+
},
|
| 23 |
+
"outputs": [],
|
| 24 |
+
"source": [
|
| 25 |
+
"from transformers import pipeline\n",
|
| 26 |
+
"import gradio as gr\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"pipe = pipeline(model=\"Yasaman/whisper_fa\")\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"def transcribe(audio):\n",
|
| 31 |
+
" text = pipe(audio)[\"text\"]\n",
|
| 32 |
+
" return text\n",
|
| 33 |
+
"\n",
|
| 34 |
+
"iface = gr.Interface(\n",
|
| 35 |
+
" fn=transcribe, \n",
|
| 36 |
+
" inputs=gr.Audio(source=\"microphone\", type=\"filepath\"), \n",
|
| 37 |
+
" outputs=\"text\",\n",
|
| 38 |
+
" title=\"Whisper Small Persian\",\n",
|
| 39 |
+
" description=\"Realtime demo for Persian speech recognition using a fine-tuned Whisper small model.\",\n",
|
| 40 |
+
")\n",
|
| 41 |
+
"\n",
|
| 42 |
+
"iface.launch()"
|
| 43 |
+
]
|
| 44 |
+
}
|
| 45 |
+
]
|
| 46 |
+
}
|
requirements.txt.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|
| 3 |
+
#pytube
|