|
28 | 28 |
|
29 | 29 | $inputDefinition = new InputDefinition([ |
30 | 30 | new InputArgument('audio-file', InputArgument::REQUIRED, 'The audio file to transcribe'), |
| 31 | + new InputOption('model', null, InputOption::VALUE_REQUIRED, 'The model to use'), |
31 | 32 | new InputOption('encoding', null, InputOption::VALUE_REQUIRED, |
32 | 33 | 'The encoding of the audio file. This is required if the encoding is ' . |
33 | 34 | 'unable to be determined. ' |
|
111 | 112 | ]); |
112 | 113 | }); |
113 | 114 |
|
| 115 | +$application->add(new Command('transcribe-model')) |
| 116 | + ->setDefinition($inputDefinition) |
| 117 | + ->setDescription('Transcribe an audio file, with selected model, using Google Cloud Speech API') |
| 118 | + ->setHelp(<<<EOF |
| 119 | +The <info>%command.name%</info> command transcribes audio from a file, with the |
| 120 | +selected model, using the Google Cloud Speech API. |
| 121 | +
|
| 122 | +<info>php %command.full_name% audio_file.wav model_name</info> |
| 123 | +
|
| 124 | +EOF |
| 125 | + ) |
| 126 | + ->setCode(function (InputInterface $input, OutputInterface $output) { |
| 127 | + $audioFile = $input->getArgument('audio-file'); |
| 128 | + $modelName = $input->getOption('model'); |
| 129 | + transcribe_model_selection($audioFile, $modelName); |
| 130 | + }); |
| 131 | + |
| 132 | +$application->add(new Command('transcribe-enhanced')) |
| 133 | + ->setDefinition($inputDefinition) |
| 134 | + ->setDescription('Transcribe an audio file, with an enhanced model, using Google Cloud Speech API') |
| 135 | + ->setHelp(<<<EOF |
| 136 | +The <info>%command.name%</info> command transcribes audio from a file, with an enhanced |
| 137 | +model, using the Google Cloud Speech API. |
| 138 | +
|
| 139 | +<info>php %command.full_name% audio_file.wav model_name</info> |
| 140 | +
|
| 141 | +EOF |
| 142 | + ) |
| 143 | + ->setCode(function (InputInterface $input, OutputInterface $output) { |
| 144 | + $path = $input->getArgument('audio-file'); |
| 145 | + transcribe_enhanced_model($path); |
| 146 | + }); |
| 147 | + |
| 148 | +$application->add(new Command('transcribe-punctuation')) |
| 149 | + ->setDefinition($inputDefinition) |
| 150 | + ->setDescription('Transcribe an audio file, with proper punctuation, using Google Cloud Speech API') |
| 151 | + ->setHelp(<<<EOF |
| 152 | +The <info>%command.name%</info> command transcribes audio from a file, with |
| 153 | +proper punctuation, using the Google Cloud Speech API. |
| 154 | +
|
| 155 | +<info>php %command.full_name% audio_file.wav</info> |
| 156 | +
|
| 157 | +EOF |
| 158 | + ) |
| 159 | + ->setCode(function (InputInterface $input, OutputInterface $output) { |
| 160 | + $path = $input->getArgument('audio-file'); |
| 161 | + transcribe_auto_punctuation($path); |
| 162 | + }); |
| 163 | + |
114 | 164 | $application->add(new Command('transcribe-async')) |
115 | 165 | ->setDefinition($inputDefinition) |
116 | 166 | ->setDescription('Transcribe an audio file asynchronously using Google Cloud Speech API') |
|
0 commit comments