Ignore:
Timestamp:
2021-08-05T12:59:41+12:00 (3 years ago)
Author:
davidb
Message:

Disable upload button while transcription is in progress

Location:
main/trunk/model-interfaces-dev/atea
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-interfaces-dev/atea/js/asr/TranscribeService.js

    r35252 r35253  
    3333    {
    3434        /** @type {String} The URL to which query POST requests should be made */
    35         this.queryUrl = "/gs3-koreromaori/transcribe";
     35        this.queryUrl = "/gs3-koreromaori/transcribe/test";
     36        this.MAX_BATCH_COUNT = 3;
     37        this.MAX_BATCH_SIZE = 5242880; // 5 MiB
    3638    }
    3739
     
    4042     * Data is chunked according to which ever occurs first:
    4143     * A maximum of three files per request, or;
    42      * A maximum of 5 MiB per request.
     44     * A maximum of 5 MiB before chunking.
    4345     *
    4446     * @param {FileList} files The files to upload
    4547     * @returns {AsyncGenerator<TranscriptionModel[]>} The transcribed audio files.
    4648     */
    47     async* chunkTranscribeFiles(files)
     49    async* batchTranscribeFiles(files)
    4850    {
    4951        let filesToSubmit = [];
     
    5153        let byteCounter = 0;
    5254
    53         for (let file of files) {
    54             if (fileCounter == 3 || byteCounter > 5242880) // 5 MiB
     55        for (let file of files)
     56        {
     57            if (fileCounter == this.MAX_BATCH_COUNT || byteCounter > this.MAX_BATCH_SIZE) // 5 MiB
    5558            {
    5659                yield await this.transcribeFiles(filesToSubmit);
  • main/trunk/model-interfaces-dev/atea/js/asr/asr-controller.js

    r35252 r35253  
    5050    const transcribeService = new TranscribeService();
    5151
     52    $(FILE_UPLOAD_INPUT_NAME).prop("disabled", true);
    5253    $(FILE_UPLOAD_PROGRESS_CONTAINER_NAME).removeClass("asr-hidden");
    5354
     
    6667    try
    6768    {
    68         for await (const transcriptionBundle of transcribeService.chunkTranscribeFiles(files))
     69        for await (const transcriptionBundle of transcribeService.batchTranscribeFiles(files))
    6970        {
    7071            for (const t of transcriptionBundle)
     
    8687
    8788    $(FILE_UPLOAD_PROGRESS_CONTAINER_NAME).addClass("asr-hidden");
     89    $(FILE_UPLOAD_INPUT_NAME).prop("disabled", false);
    8890}
    8991
  • main/trunk/model-interfaces-dev/atea/transform/pages/asr.xsl

    r35252 r35253  
    3838    <!-- Template for processing audio file uploads -->
    3939    <xsl:template name="audio-upload">
    40         <link rel="stylesheet" href="interfaces/{$interface_name}/style/asr.css" type="text/css" />
     40        <link href="interfaces/{$interface_name}/style/asr.css" rel="stylesheet" type="text/css" />
    4141       
    4242        <div>
Note: See TracChangeset for help on using the changeset viewer.