Spaces:
Sleeping
Sleeping
Create app file
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import mlx_whisper
|
| 3 |
+
|
| 4 |
+
def transcribe(audio):
|
| 5 |
+
text = mlx_whisper.transcribe(
|
| 6 |
+
audio,
|
| 7 |
+
path_or_hf="Kimang18/whisper-tiny-khmer-mlx-fp32",
|
| 8 |
+
fp16=False,
|
| 9 |
+
condition_on_previous_text=False,
|
| 10 |
+
)['text']
|
| 11 |
+
return text
|
| 12 |
+
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=transcribe,
|
| 15 |
+
inputs=gr.Audio(type="filepath", waveform_options={"sample_rate": 16000}),
|
| 16 |
+
outputs="text",
|
| 17 |
+
title="Whisper Tiny Khmer",
|
| 18 |
+
description="Realtime demo for Khmer speech transcription using a fine-tuned Whisper tiny model.",
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
iface.launch(share=False)
|