Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,8 +118,10 @@ renamed_audio_file = None
|
|
| 118 |
|
| 119 |
model_configurations = {}
|
| 120 |
|
|
|
|
| 121 |
@app.on_event("startup")
|
| 122 |
async def load_model_data():
|
|
|
|
| 123 |
# Load data for all models in the directory upon startup
|
| 124 |
sys.path.append('./content/piper/src/python')
|
| 125 |
models_path = "./content/piper/src/python"
|
|
@@ -133,6 +135,7 @@ async def load_model_data():
|
|
| 133 |
|
| 134 |
# Collect data for all models in the directory and populate model_configurations
|
| 135 |
model_names = detect_onnx_models(models_path)
|
|
|
|
| 136 |
for model_name in model_names:
|
| 137 |
# Load the configuration data for each model (including speaker_id_map)
|
| 138 |
config = load_model_configuration(model_name)
|
|
|
|
| 118 |
|
| 119 |
model_configurations = {}
|
| 120 |
|
| 121 |
+
|
| 122 |
@app.on_event("startup")
|
| 123 |
async def load_model_data():
|
| 124 |
+
global onnx_models # Make onnx_models available globally
|
| 125 |
# Load data for all models in the directory upon startup
|
| 126 |
sys.path.append('./content/piper/src/python')
|
| 127 |
models_path = "./content/piper/src/python"
|
|
|
|
| 135 |
|
| 136 |
# Collect data for all models in the directory and populate model_configurations
|
| 137 |
model_names = detect_onnx_models(models_path)
|
| 138 |
+
onnx_models = model_names # Populate onnx_models here
|
| 139 |
for model_name in model_names:
|
| 140 |
# Load the configuration data for each model (including speaker_id_map)
|
| 141 |
config = load_model_configuration(model_name)
|