From 24c99f554fa61f5ec4a97fd53910a2ff5d0ccbf6 Mon Sep 17 00:00:00 2001 From: Krunal6767 <106827625+Krunal6767@users.noreply.github.com> Date: Sat, 16 Sep 2023 01:36:12 -0400 Subject: [PATCH] Update DeepSpeech.py --- DeepSpeech.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/DeepSpeech.py b/DeepSpeech.py index 0fa4ae8a80..346b06099e 100755 --- a/DeepSpeech.py +++ b/DeepSpeech.py @@ -2,11 +2,29 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function -if __name__ == '__main__': +import sys +import subprocess + +def check_training_package(): + try: + import deepspeech_training # Check if the training package is installed + return True + except ImportError: + return False + +def run_training(): try: from deepspeech_training import train as ds_train + ds_train.run_script() # Run the DeepSpeech training script except ImportError: print('Training package is not installed. See training documentation.') - raise + except Exception as e: + print(f'An error occurred during training: {e}') + +if __name__ == '__main__': + if not check_training_package(): + print('DeepSpeech training package is not installed.') + print('Please install it by following the training documentation.') + sys.exit(1) - ds_train.run_script() + run_training()