xJuuzouYTx commited on
Commit
3961eb2
1 Parent(s): 4dc2207

[ADD] download model error message

Browse files
Files changed (2) hide show
  1. inference.py +3 -0
  2. models/model.py +2 -2
inference.py CHANGED
@@ -198,6 +198,9 @@ class Inference:
198
  modelname = model.model_downloader(
199
  self._model_name, "./zips/", "./weights/")
200
 
 
 
 
201
  model_info = model.get_model(os.path.join(current_dir, 'weights') , modelname)
202
  if not model_info:
203
  return "No se encontrado un modelo valido, verifica el contenido del enlace e intentalo más tarde."
 
198
  modelname = model.model_downloader(
199
  self._model_name, "./zips/", "./weights/")
200
 
201
+ if not modelname:
202
+ return "No se ha podido descargar el modelo, intenta con otro enlace o intentalo más tarde."
203
+
204
  model_info = model.get_model(os.path.join(current_dir, 'weights') , modelname)
205
  if not model_info:
206
  return "No se encontrado un modelo valido, verifica el contenido del enlace e intentalo más tarde."
models/model.py CHANGED
@@ -73,7 +73,6 @@ def infer(model, f0_method, audio_file, index_rate, vc_transform0, protect0, res
73
  if not audio_file:
74
  return "No audio file specified, please load an audio file.", None
75
 
76
-
77
  inference = Inference(
78
  model_name=model,
79
  f0_method=f0_method,
@@ -85,13 +84,14 @@ def infer(model, f0_method, audio_file, index_rate, vc_transform0, protect0, res
85
  harvest_median_filter=filter_radius1,
86
  output_file_name=os.path.join("./audio-outputs", os.path.basename(audio_file))
87
  )
 
88
  output = inference.run()
89
  if 'success' in output and output['success']:
90
  print("Inferencia realizada exitosamente...")
91
  return output, output['file']
92
  else:
93
  print("Fallo en la inferencia...", output)
94
- return "Failed", None
95
 
96
  def post_model(name, model_url, version, creator):
97
  modelname = model_downloader(model_url, zips_folder, unzips_folder)
 
73
  if not audio_file:
74
  return "No audio file specified, please load an audio file.", None
75
 
 
76
  inference = Inference(
77
  model_name=model,
78
  f0_method=f0_method,
 
84
  harvest_median_filter=filter_radius1,
85
  output_file_name=os.path.join("./audio-outputs", os.path.basename(audio_file))
86
  )
87
+
88
  output = inference.run()
89
  if 'success' in output and output['success']:
90
  print("Inferencia realizada exitosamente...")
91
  return output, output['file']
92
  else:
93
  print("Fallo en la inferencia...", output)
94
+ return output, None
95
 
96
  def post_model(name, model_url, version, creator):
97
  modelname = model_downloader(model_url, zips_folder, unzips_folder)