Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,22 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
-
|
| 4 |
-
data = f.read()
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|