Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
import time
|
4 |
+
|
5 |
+
p = pipeline("automatic-speech-recognition", model="openai/whisper-medium")
|
6 |
+
|
7 |
+
|
8 |
+
def transcribe(audio1):
|
9 |
+
mic_audio_transcription = p(audio1, generate_kwargs={"task": "transcribe"})["text"] if audio1 else ""
|
10 |
+
return mic_audio_transcription
|
11 |
+
|
12 |
+
gr.Interface(
|
13 |
+
fn=transcribe,
|
14 |
+
inputs=[gr.Audio(source="microphone", type="filepath")],
|
15 |
+
outputs=["text"]).launch()
|