Flux9665 commited on
Commit
3a5e670
·
1 Parent(s): c36ac2d

try to figure out how ZeroGPU works

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -117,6 +117,9 @@ class ControllableInterface(torch.nn.Module):
117
  loudness_in_db=loudness_in_db)
118
  return sr, wav, fig
119
 
 
 
 
120
 
121
  title = "Controllable Text-to-Speech for over 7000 Languages"
122
  article = "Check out the IMS Toucan TTS Toolkit at https://github.com/DigitalPhonetics/IMS-Toucan"
@@ -124,7 +127,7 @@ available_artificial_voices = 1000
124
  path_to_iso_list = "Preprocessing/multilinguality/iso_to_fullname.json"
125
  iso_to_name = load_json_from_path(path_to_iso_list)
126
  text_selection = [f"{iso_to_name[iso_code]} Text ({iso_code})" for iso_code in iso_to_name]
127
- gw = GanWrapper(os.path.join(MODELS_DIR, "Embedding", "embedding_gan.pt"), device="cuda" if torch.cuda.is_available() else "cpu")
128
  controllable_ui = ControllableInterface(gan_wrapper=gw, available_artificial_voices=available_artificial_voices)
129
 
130
 
 
117
  loudness_in_db=loudness_in_db)
118
  return sr, wav, fig
119
 
120
+ @spaces.GPU
121
+ def get_gw():
122
+ return GanWrapper(os.path.join(MODELS_DIR, "Embedding", "embedding_gan.pt"), device="cuda" if torch.cuda.is_available() else "cpu")
123
 
124
  title = "Controllable Text-to-Speech for over 7000 Languages"
125
  article = "Check out the IMS Toucan TTS Toolkit at https://github.com/DigitalPhonetics/IMS-Toucan"
 
127
  path_to_iso_list = "Preprocessing/multilinguality/iso_to_fullname.json"
128
  iso_to_name = load_json_from_path(path_to_iso_list)
129
  text_selection = [f"{iso_to_name[iso_code]} Text ({iso_code})" for iso_code in iso_to_name]
130
+ gw = get_gw()
131
  controllable_ui = ControllableInterface(gan_wrapper=gw, available_artificial_voices=available_artificial_voices)
132
 
133