drewThomasson commited on
Commit
ca738f2
·
verified ·
1 Parent(s): de813d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -30,11 +30,11 @@ def get_file_extension(file_path):
30
 
31
  # Function to convert the audio file using ffmpeg
32
  def convert_audio(file, output_format):
33
- input_extension = get_file_extension(file.name)
34
- output_file = file.name.replace(input_extension, f'.{output_format}')
35
 
36
  # FFmpeg command to convert the audio file
37
- command = f'ffmpeg -i "{file.name}" "{output_file}"'
38
  subprocess.run(command, shell=True)
39
 
40
  return output_file
@@ -51,7 +51,7 @@ input_formats, output_formats = get_supported_formats()
51
  with gr.Blocks() as app:
52
  gr.Markdown("## Audio Converter using FFmpeg - Full Format Support")
53
  with gr.Row():
54
- input_file = gr.File(label="Upload Audio File", type="file")
55
  output_format = gr.Dropdown(choices=output_formats, label="Select Output Format")
56
  output_file = gr.File(label="Converted Audio File")
57
 
 
30
 
31
  # Function to convert the audio file using ffmpeg
32
  def convert_audio(file, output_format):
33
+ input_extension = get_file_extension(file)
34
+ output_file = file.replace(input_extension, f'.{output_format}')
35
 
36
  # FFmpeg command to convert the audio file
37
+ command = f'ffmpeg -i "{file}" "{output_file}"'
38
  subprocess.run(command, shell=True)
39
 
40
  return output_file
 
51
  with gr.Blocks() as app:
52
  gr.Markdown("## Audio Converter using FFmpeg - Full Format Support")
53
  with gr.Row():
54
+ input_file = gr.File(label="Upload Audio File", type="filepath") # Updated type to 'filepath'
55
  output_format = gr.Dropdown(choices=output_formats, label="Select Output Format")
56
  output_file = gr.File(label="Converted Audio File")
57