Devion333 commited on
Commit
269d84d
·
verified ·
1 Parent(s): da7c70d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -1
app.py CHANGED
@@ -2,7 +2,29 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  # Load ASR pipeline
5
- asr_pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-small")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # 🔹 Replace with your own model if you trained one, e.g., "Devion333/whisper-small-dv-syn"
7
 
8
  def transcribe(audio):
 
2
  from transformers import pipeline
3
 
4
  # Load ASR pipeline
5
+ asr_pipeline = pipeline(task="automatic-speech-recognition", model="import gradio as gr
6
+ from transformers import pipeline
7
+
8
+ # Load ASR pipeline
9
+ asr_pipeline = pipeline(task="automatic-speech-recognition", model="Devion333/wav2vec2-xls-r-300m-dv")
10
+ # 🔹 Replace with your own model if you trained one, e.g., "Devion333/whisper-small-dv-syn"
11
+
12
+ def transcribe(audio):
13
+ result = asr_pipeline(audio)
14
+ return result["text"]
15
+
16
+ # Build Gradio app
17
+ gradio_app = gr.Interface(
18
+ fn=transcribe,
19
+ inputs=gr.Audio(sources=["upload", "microphone"], type="filepath", label="Speak or Upload Audio"),
20
+ outputs=gr.Textbox(label="Transcription"),
21
+ title="Speech-to-Text (ASR)",
22
+ description="Upload an audio file or record speech and get the transcription using a Hugging Face ASR model."
23
+ )
24
+
25
+ if __name__ == "__main__":
26
+ gradio_app.launch()
27
+ ")
28
  # 🔹 Replace with your own model if you trained one, e.g., "Devion333/whisper-small-dv-syn"
29
 
30
  def transcribe(audio):