TuringsSolutions commited on
Commit
7f8f5d6
1 Parent(s): 0255c8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -7,8 +7,8 @@ recognizer = sr.Recognizer()
7
 
8
  def transcribe_audio(audio):
9
  try:
10
- # Convert audio input to .wav if needed
11
- audio_data = AudioSegment.from_file(audio.name)
12
  audio_data.export("audio.wav", format="wav")
13
 
14
  # Use recognizer to transcribe the audio
@@ -25,7 +25,7 @@ with gr.Blocks() as demo:
25
  gr.Markdown("# Lecture Note Transcription App")
26
 
27
  with gr.Row():
28
- audio_input = gr.Audio(source="microphone", type="filepath", label="Record Lecture Audio")
29
  output_text = gr.Textbox(label="Transcription", lines=10)
30
 
31
  submit_button = gr.Button("Transcribe")
@@ -34,4 +34,4 @@ with gr.Blocks() as demo:
34
  submit_button.click(fn=transcribe_audio, inputs=[audio_input], outputs=[output_text])
35
 
36
  # Launch the Gradio app
37
- demo.launch()
 
7
 
8
  def transcribe_audio(audio):
9
  try:
10
+ # Load the audio and convert to WAV format if necessary
11
+ audio_data = AudioSegment.from_file(audio)
12
  audio_data.export("audio.wav", format="wav")
13
 
14
  # Use recognizer to transcribe the audio
 
25
  gr.Markdown("# Lecture Note Transcription App")
26
 
27
  with gr.Row():
28
+ audio_input = gr.Audio(type="filepath", label="Upload or Record Lecture Audio")
29
  output_text = gr.Textbox(label="Transcription", lines=10)
30
 
31
  submit_button = gr.Button("Transcribe")
 
34
  submit_button.click(fn=transcribe_audio, inputs=[audio_input], outputs=[output_text])
35
 
36
  # Launch the Gradio app
37
+ demo.launch()