Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
if isinstance(audio, str):
|
| 7 |
-
return (audio)
|
| 8 |
-
else:
|
| 9 |
-
return "Processed audio output"
|
| 10 |
|
| 11 |
-
with gr.Blocks() as iface:
|
| 12 |
-
with gr.Row():
|
| 13 |
-
audio_in = gr.Audio(source="microphone", type="filepath")
|
| 14 |
-
file_in = gr.File(file_type="audio")
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from sad_tf import *
|
| 3 |
|
| 4 |
+
seg = Segmenter(ffmpeg_path="ffmpeg",model_path="keras_speech_music_noise_cnn.hdf5" , device="cpu")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
def transcribe_audio(audio_file):
|
| 8 |
+
isig = seg(audio_file)
|
| 9 |
+
return isig
|
| 10 |
|
| 11 |
+
# Define the Gradio interface
|
| 12 |
+
interface = gr.Interface(
|
| 13 |
+
fn=transcribe_audio,
|
| 14 |
+
inputs=gr.Audio(type="filepath"), # Removed 'source="microphone"'
|
| 15 |
+
outputs="text",
|
| 16 |
+
title="Audio Transcription",
|
| 17 |
+
description="Upload an audio file or record audio to get the transcription."
|
| 18 |
+
)
|
| 19 |
|
| 20 |
+
# Launch the Gradio app
|
| 21 |
+
interface.launch()
|