\n",
"
\n",
"
\n",
" OpenVINO Distil-Whisper demo\n",
"
\n",
" \n",
"
\n",
" \"\"\"\n",
" )\n",
" audio = gr.components.Audio(type=\"filepath\", label=\"Audio input\")\n",
" with gr.Row():\n",
" button = gr.Button(\"Transcribe\")\n",
" if to_quantize.value:\n",
" button_q = gr.Button(\"Transcribe quantized\")\n",
" with gr.Row():\n",
" infer_time = gr.components.Textbox(label=\"OpenVINO Distil-Whisper Transcription Time (s)\")\n",
" if to_quantize.value:\n",
" infer_time_q = gr.components.Textbox(label=\"OpenVINO Quantized Distil-Whisper Transcription Time (s)\")\n",
" with gr.Row():\n",
" transcription = gr.components.Textbox(label=\"OpenVINO Distil-Whisper Transcription\", show_copy_button=True)\n",
" if to_quantize.value:\n",
" transcription_q = gr.components.Textbox(\n",
" label=\"OpenVINO Quantized Distil-Whisper Transcription\",\n",
" show_copy_button=True,\n",
" )\n",
" button.click(\n",
" fn=transcribe,\n",
" inputs=audio,\n",
" outputs=[transcription, infer_time],\n",
" )\n",
" if to_quantize.value:\n",
" button_q.click(\n",
" fn=transcribe,\n",
" inputs=[audio, gr.Number(value=1, visible=False)],\n",
" outputs=[transcription_q, infer_time_q],\n",
" )\n",
" gr.Markdown(\"## Examples\")\n",
" gr.Examples(\n",
" [[\"./example_1.wav\"]],\n",
" audio,\n",
" outputs=[transcription, infer_time],\n",
" fn=transcribe,\n",
" cache_examples=False,\n",
" )\n",
"# if you are launching remotely, specify server_name and server_port\n",
"# demo.launch(server_name='your server name', server_port='server port in int')\n",
"# Read more in the docs: https://gradio.app/docs/\n",
"try:\n",
" demo.launch(debug=True)\n",
"except Exception:\n",
" demo.launch(share=True, debug=True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
},
"openvino_notebooks": {
"imageUrl": "https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/52c58b58-7730-48d2-803d-4af0b6115499",
"tags": {
"categories": [
"Model Demos",
"AI Trends"
],
"libraries": [],
"other": [],
"tasks": [
"Speech Recognition"
]
}
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}