Tlanextli commited on
Commit
0cdce1f
·
1 Parent(s): 7086931

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -1,8 +1,22 @@
1
- from transformers import pipeline
2
 
3
- with open("mlk.flac", "rb") as f:
4
- data = f.read()
5
 
6
- pipe = pipeline("automatic-speech-recognition", "openai/whisper-large-v2")
7
- pipe("mlk.flac")
8
- # {'text': "GOING ALONG SLUSHY COUNTRY ROADS AND SPEAKING TO DAMP AUDIENCES IN DRAUGHTY SCHOOL ROOMS DAY AFTER DAY FOR A FORTNIGHT HE'LL HAVE TO PUT IN AN APPEARANCE AT SOME PLACE OF WORSHIP ON SUNDAY MORNING AND HE CAN COME TO US IMMEDIATELY AFTERWARDS"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
 
3
+ import numpy as np
 
4
 
5
+ import gradio as gr
6
+
7
+
8
+ def reverse_audio(audio):
9
+ sr, data = audio
10
+ return (sr, np.flipud(data))
11
+
12
+
13
+ demo = gr.Interface(fn=reverse_audio,
14
+ inputs="microphone",
15
+ outputs="audio",
16
+ examples=[
17
+ "https://samplelib.com/lib/preview/mp3/sample-3s.mp3",
18
+ os.path.join(os.path.dirname(__file__), "audio/recording1.wav")
19
+ ], cache_examples=True)
20
+
21
+ if __name__ == "__main__":
22
+ demo.launch()