Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,8 @@ load_dotenv()
|
|
| 39 |
MAX_INPUT_TEXT_LEN = int(os.environ.get("MAX_INPUT_TEXT_LEN", default=500))
|
| 40 |
|
| 41 |
# Dynamically read model files, exclude 'speakers.pth'
|
| 42 |
-
model_files = [f for f in os.listdir(os.getcwd()) if f.endswith('.pth') and f != 'speakers.pth']
|
|
|
|
| 43 |
# model_files.sort(key=lambda x: os.path.getmtime(os.path.join(os.getcwd(), x)), reverse=True)
|
| 44 |
|
| 45 |
speakers_path = "speakers.pth"
|
|
@@ -55,6 +56,7 @@ google_speakers = [s for s in speakers_list if 3 < len(s) < 20] #
|
|
| 55 |
commonvoice_speakers = [s for s in speakers_list if len(s) > 20] #
|
| 56 |
|
| 57 |
DEFAULT_SPEAKER_ID = os.environ.get("DEFAULT_SPEAKER_ID", default="pau")
|
|
|
|
| 58 |
model_file = model_files[0] # change this!!
|
| 59 |
|
| 60 |
model_path = os.path.join(os.getcwd(), model_file)
|
|
@@ -170,6 +172,7 @@ with gr.Blocks(**AinaGradioTheme().get_kwargs()) as app:
|
|
| 170 |
|
| 171 |
speaker_id = gr.Dropdown(label="Select a voice", choices=speakers_list, value=DEFAULT_SPEAKER_ID,
|
| 172 |
interactive=True)
|
|
|
|
| 173 |
dataset.change(fn=update_speaker_list, inputs=dataset, outputs=speaker_id)
|
| 174 |
|
| 175 |
# model = gr.Dropdown(label="Select a model", choices=model_files, value=DEFAULT_MODEL_FILE_NAME)
|
|
|
|
| 39 |
MAX_INPUT_TEXT_LEN = int(os.environ.get("MAX_INPUT_TEXT_LEN", default=500))
|
| 40 |
|
| 41 |
# Dynamically read model files, exclude 'speakers.pth'
|
| 42 |
+
# model_files = [f for f in os.listdir(os.getcwd()) if f.endswith('.pth') and f != 'speakers.pth']
|
| 43 |
+
model_files = [f for f in os.listdir('./checkpoints') if f.endswith('.pth')]
|
| 44 |
# model_files.sort(key=lambda x: os.path.getmtime(os.path.join(os.getcwd(), x)), reverse=True)
|
| 45 |
|
| 46 |
speakers_path = "speakers.pth"
|
|
|
|
| 56 |
commonvoice_speakers = [s for s in speakers_list if len(s) > 20] #
|
| 57 |
|
| 58 |
DEFAULT_SPEAKER_ID = os.environ.get("DEFAULT_SPEAKER_ID", default="pau")
|
| 59 |
+
DEFAULT_CHECKPOINT = os.environ.get("DEFAULT_CHECKPOINT", default=model_files[0])
|
| 60 |
model_file = model_files[0] # change this!!
|
| 61 |
|
| 62 |
model_path = os.path.join(os.getcwd(), model_file)
|
|
|
|
| 172 |
|
| 173 |
speaker_id = gr.Dropdown(label="Select a voice", choices=speakers_list, value=DEFAULT_SPEAKER_ID,
|
| 174 |
interactive=True)
|
| 175 |
+
model_chkpt = gr.Dropdown(label="Select a checkpoint", choices=model_files, value=DEFAULT_CHECKPOINT, interactive=True)
|
| 176 |
dataset.change(fn=update_speaker_list, inputs=dataset, outputs=speaker_id)
|
| 177 |
|
| 178 |
# model = gr.Dropdown(label="Select a model", choices=model_files, value=DEFAULT_MODEL_FILE_NAME)
|