pawipa commited on
Commit
3f95d23
·
1 Parent(s): 28b02dc
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -59,9 +59,9 @@ def convert_to_wav(file_path: str) -> str:
59
  Returns:
60
  str: Path to the converted WAV file.
61
  """
62
- if file_path.endswith(".m4a"):
63
- audio = AudioSegment.from_file(file_path, format="m4a")
64
- wav_path = file_path.replace(".m4a", ".wav")
65
  audio.export(wav_path, format="wav")
66
  return wav_path
67
  return file_path
@@ -166,7 +166,7 @@ with gr.Blocks() as demo:
166
  # Input section
167
  with gr.Row():
168
  with gr.Column():
169
- file_input = gr.Files(file_types=[".wav", ".mp3", ".m4a"], label="Upload your audio files")
170
  with gr.Column():
171
  model_dropdown = gr.Dropdown(
172
  choices=[
@@ -204,8 +204,6 @@ with gr.Blocks() as demo:
204
  outputs=[file_input, model_dropdown, dropdown_2, output_md, output_files],
205
  )
206
 
207
- gr.Textbox(os.getcwd(), label="Current Working Directory")
208
-
209
  gr.Image("Fraunhofer-IPA-Logo.jpg", show_label=False)
210
 
211
  # Centered Footer with Logo and Licensing Text
@@ -231,4 +229,3 @@ demo.css = """
231
 
232
  # Launch app
233
  demo.launch()
234
-
 
59
  Returns:
60
  str: Path to the converted WAV file.
61
  """
62
+ if file_path.endswith(".m4a") or file_path.endswith(".aac"):
63
+ audio = AudioSegment.from_file(file_path)
64
+ wav_path = file_path.rsplit('.', 1)[0] + ".wav"
65
  audio.export(wav_path, format="wav")
66
  return wav_path
67
  return file_path
 
166
  # Input section
167
  with gr.Row():
168
  with gr.Column():
169
+ file_input = gr.Files(file_types=[".wav", ".mp3", ".m4a", ".aac"], label="Upload your audio files")
170
  with gr.Column():
171
  model_dropdown = gr.Dropdown(
172
  choices=[
 
204
  outputs=[file_input, model_dropdown, dropdown_2, output_md, output_files],
205
  )
206
 
 
 
207
  gr.Image("Fraunhofer-IPA-Logo.jpg", show_label=False)
208
 
209
  # Centered Footer with Logo and Licensing Text
 
229
 
230
  # Launch app
231
  demo.launch()