imansarraf commited on
Commit
2f5b4f8
·
verified ·
1 Parent(s): 575f3fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -1,21 +1,21 @@
1
-
2
  import gradio as gr
 
3
 
4
- def process_audio(audio):
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
- output = gr.Textbox()
 
 
17
 
18
- inputs = [audio_in, file_in]
19
- iface.submit(fn=process_audio, inputs=inputs, outputs=output)
 
 
 
 
 
 
20
 
21
- iface.launch()
 
 
 
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()