Update app.py
Browse files
app.py
CHANGED
|
@@ -16,11 +16,11 @@ def get_training_info(audio_file):
|
|
| 16 |
"""Determine training parameters based on the duration of the audio file."""
|
| 17 |
try:
|
| 18 |
if audio_file is None:
|
| 19 |
-
|
| 20 |
-
return gr.Error('Please provide an audio file.')
|
| 21 |
|
| 22 |
duration = get_audio_duration(audio_file)
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
training_info = {
|
| 26 |
(0, 2): (150, 'TITAN'),
|
|
@@ -38,7 +38,7 @@ def get_training_info(audio_file):
|
|
| 38 |
|
| 39 |
return 'Duration is not within the specified range.'
|
| 40 |
except ValueError as e:
|
| 41 |
-
return
|
| 42 |
|
| 43 |
with gr.Blocks(theme=gr.themes.Base(primary_hue="sky", secondary_hue="blue"), title="RVC TRAINING HELPER") as demo:
|
| 44 |
with gr.Tab("Main Settings"):
|
|
|
|
| 16 |
"""Determine training parameters based on the duration of the audio file."""
|
| 17 |
try:
|
| 18 |
if audio_file is None:
|
| 19 |
+
return "Please provide an audio file."
|
|
|
|
| 20 |
|
| 21 |
duration = get_audio_duration(audio_file)
|
| 22 |
+
with wave.open(audio_file, 'rb') as audio:
|
| 23 |
+
sample_rate = audio.getframerate()
|
| 24 |
|
| 25 |
training_info = {
|
| 26 |
(0, 2): (150, 'TITAN'),
|
|
|
|
| 38 |
|
| 39 |
return 'Duration is not within the specified range.'
|
| 40 |
except ValueError as e:
|
| 41 |
+
return str(e)
|
| 42 |
|
| 43 |
with gr.Blocks(theme=gr.themes.Base(primary_hue="sky", secondary_hue="blue"), title="RVC TRAINING HELPER") as demo:
|
| 44 |
with gr.Tab("Main Settings"):
|