Spaces:
Sleeping
Sleeping
update to 30 seconds
Browse files
app.py
CHANGED
|
@@ -94,10 +94,10 @@ def process_audio_file(audio_path):
|
|
| 94 |
# Load and resample audio
|
| 95 |
audio_data, sr = librosa.load(audio_path, sr=target_sr)
|
| 96 |
|
| 97 |
-
# Limit to
|
| 98 |
-
max_samples =
|
| 99 |
if len(audio_data) > max_samples:
|
| 100 |
-
logger.info(f"Truncating audio to
|
| 101 |
audio_data = audio_data[:max_samples]
|
| 102 |
|
| 103 |
return audio_data
|
|
@@ -265,7 +265,7 @@ def create_interface():
|
|
| 265 |
type="filepath",
|
| 266 |
sources=["upload", "microphone"]
|
| 267 |
)
|
| 268 |
-
gr.Markdown("*Upload an audio file (WAV or MP3,
|
| 269 |
|
| 270 |
# Set audio button
|
| 271 |
set_audio_btn = gr.Button("Set Audio Track", variant="primary")
|
|
|
|
| 94 |
# Load and resample audio
|
| 95 |
audio_data, sr = librosa.load(audio_path, sr=target_sr)
|
| 96 |
|
| 97 |
+
# Limit to 30 seconds for better performance
|
| 98 |
+
max_samples = 30 * target_sr
|
| 99 |
if len(audio_data) > max_samples:
|
| 100 |
+
logger.info(f"Truncating audio to 30 seconds")
|
| 101 |
audio_data = audio_data[:max_samples]
|
| 102 |
|
| 103 |
return audio_data
|
|
|
|
| 265 |
type="filepath",
|
| 266 |
sources=["upload", "microphone"]
|
| 267 |
)
|
| 268 |
+
gr.Markdown("*Upload an audio file (WAV or MP3, 30 seconds will be analyzed)*")
|
| 269 |
|
| 270 |
# Set audio button
|
| 271 |
set_audio_btn = gr.Button("Set Audio Track", variant="primary")
|