szili2011 commited on
Commit
378e118
·
verified ·
1 Parent(s): 80acfa0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -4,8 +4,8 @@ from pydub import AudioSegment
4
  import gradio as gr
5
 
6
  def load_audio(file):
7
- # Use librosa to load the audio file
8
- audio, sr = librosa.load(file.name, sr=None)
9
  return audio, sr
10
 
11
  def get_segment(audio, sr):
@@ -58,7 +58,7 @@ def extend_music(file, added_minutes):
58
  segment = get_segment(audio, sr)
59
 
60
  # Convert the original audio to pydub format for manipulation
61
- original_audio_segment = AudioSegment.from_file(file.name)
62
 
63
  # Calculate the original duration in seconds
64
  original_duration_seconds = len(audio) / sr
 
4
  import gradio as gr
5
 
6
  def load_audio(file):
7
+ # Use librosa to load the audio file directly from the file path
8
+ audio, sr = librosa.load(file, sr=None) # Changed file.name to file
9
  return audio, sr
10
 
11
  def get_segment(audio, sr):
 
58
  segment = get_segment(audio, sr)
59
 
60
  # Convert the original audio to pydub format for manipulation
61
+ original_audio_segment = AudioSegment.from_file(file)
62
 
63
  # Calculate the original duration in seconds
64
  original_duration_seconds = len(audio) / sr