Gregniuki commited on
Commit
92a9cde
·
1 Parent(s): 8fbbdf8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -13,12 +13,11 @@ enhanced_accessibility = False #@param {type:"boolean"}
13
  #@markdown ---
14
  use_gpu = False #@param {type:"boolean"}
15
 
16
- from fastapi import FastAPI, Request, Form, Depends
17
  from fastapi.responses import HTMLResponse
18
  from fastapi.responses import FileResponse
19
  from fastapi.templating import Jinja2Templates
20
  from fastapi.staticfiles import StaticFiles
21
- from typing import Tuple
22
  # ...
23
  # Mount a directory to serve static files (e.g., CSS and JavaScript)
24
 
@@ -144,9 +143,7 @@ def get_initial_values():
144
  return selected_model, selected_speaker_id
145
  @app.get("/get_speaker_id_map")
146
  async def get_speaker_id_map(selected_model: str):
147
- print("selected model", selected_model + ".json")
148
  config = model_configurations.get(selected_model + ".json")
149
- print("selected config", config)
150
 
151
  if config:
152
  speaker_id_map = config.get("speaker_id_map", {})
@@ -174,10 +171,7 @@ async def load_model_data():
174
  # Collect data for all models in the directory and populate model_configurations
175
  model_names, config_names = detect_onnx_models(models_path)
176
  onnx_models = model_names # Populate onnx_models here
177
- print(config_names[0])
178
- print(model_names[0])
179
  for config_name in config_names:
180
- print(config_name)
181
  # Load the configuration data for each model (including speaker_id_map)
182
  config = load_model_configuration(models_path, config_name) # Pass config_name, not models_path
183
 
@@ -247,6 +241,8 @@ async def main(
247
  model, config = load_onnx(selected_model, sess_options, providers)
248
  config["espeak"]["voice"] = speaker
249
  # speaker_id_map = config.get("speaker_id_map", {})
 
 
250
 
251
  auto_play = play
252
  audio = inferencing(model, config, selected_speaker_id, text_input, speed_slider, noise_scale_slider, noise_scale_w_slider, auto_play)
 
13
  #@markdown ---
14
  use_gpu = False #@param {type:"boolean"}
15
 
16
+ from fastapi import FastAPI, Request, Form
17
  from fastapi.responses import HTMLResponse
18
  from fastapi.responses import FileResponse
19
  from fastapi.templating import Jinja2Templates
20
  from fastapi.staticfiles import StaticFiles
 
21
  # ...
22
  # Mount a directory to serve static files (e.g., CSS and JavaScript)
23
 
 
143
  return selected_model, selected_speaker_id
144
  @app.get("/get_speaker_id_map")
145
  async def get_speaker_id_map(selected_model: str):
 
146
  config = model_configurations.get(selected_model + ".json")
 
147
 
148
  if config:
149
  speaker_id_map = config.get("speaker_id_map", {})
 
171
  # Collect data for all models in the directory and populate model_configurations
172
  model_names, config_names = detect_onnx_models(models_path)
173
  onnx_models = model_names # Populate onnx_models here
 
 
174
  for config_name in config_names:
 
175
  # Load the configuration data for each model (including speaker_id_map)
176
  config = load_model_configuration(models_path, config_name) # Pass config_name, not models_path
177
 
 
241
  model, config = load_onnx(selected_model, sess_options, providers)
242
  config["espeak"]["voice"] = speaker
243
  # speaker_id_map = config.get("speaker_id_map", {})
244
+ print(text_input)
245
+ print(speaker)
246
 
247
  auto_play = play
248
  audio = inferencing(model, config, selected_speaker_id, text_input, speed_slider, noise_scale_slider, noise_scale_w_slider, auto_play)