Update app.py
Browse files
app.py
CHANGED
|
@@ -7,14 +7,13 @@ import soundfile as sf
|
|
| 7 |
pipe1 = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
| 8 |
|
| 9 |
def transcribe_audio(audio):
|
| 10 |
-
audio_data, _ = sf.read(audio)
|
| 11 |
-
audio_array = np.array(audio_data)
|
| 12 |
|
| 13 |
transcription = pipe1(audio_array)
|
| 14 |
transcription_text = transcription['text']
|
| 15 |
|
| 16 |
return transcription_text
|
| 17 |
|
| 18 |
-
|
| 19 |
-
demo = gr.Interface(fn=transcribe_audio, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text")
|
| 20 |
demo.launch(share=True)
|
|
|
|
| 7 |
pipe1 = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
| 8 |
|
| 9 |
def transcribe_audio(audio):
|
| 10 |
+
audio_data, _ = sf.read(audio)
|
| 11 |
+
audio_array = np.array(audio_data)
|
| 12 |
|
| 13 |
transcription = pipe1(audio_array)
|
| 14 |
transcription_text = transcription['text']
|
| 15 |
|
| 16 |
return transcription_text
|
| 17 |
|
| 18 |
+
demo = gr.Interface(fn=transcribe_audio, inputs=gr.Audio(), outputs="text")
|
|
|
|
| 19 |
demo.launch(share=True)
|