Page MenuHomePhabricator

Disable "Transcribe Full Page" button during transcription
Closed, ResolvedPublic2 Estimated Story Points

Description

After the Transcribe Full Page button on the OCR tool has been clicked once, it should be disabled while the transcription process is taking place. It should be enabled again after the transcribed text is placed in the text box. This prevents multiple submissions of the request being made.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@PMenon-WMF could you share which browser and skin you are using? On quick check I was not able to reproduce this issue.

Using Chrome and the Vector22 skin. I think the multiple submissions do not really take effect because of the caching, but it might still be a good idea to disable the button after it has been clicked and enable it once the results are ready. What do you think?

Using Chrome and the Vector22 skin. I think the multiple submissions do not really take effect because of the caching, but it might still be a good idea to disable the button after it has been clicked and enable it once the results are ready. What do you think?

That's the behaviour I see, actually. Could you give a link to an example page where you're seeing this? I tested on English Wikisource (example). There the button says "Transcribe text", not "Transcribe Full Page", so I wonder if we're talking about different buttons entirely?

Oh, I mean the "Transcribe Full Page" button on the OCR tool. It was unclear in the task description, I have updated it now. Thank you for bringing it to notice :)

Ohhh, sorry I misunderstood! In that case everything you're proposing makes perfect sense :) We've got this queued up for estimation on our team. I don't know when we'll be able to work on it but it should be relatively easy. Adding good first task in case any newbies want to take a stab at it :)

Source code: https://github.com/wikimedia/wikimedia-ocr

dmaza set the point value for this task to 2.Apr 19 2023, 2:52 PM
dmaza moved this task from Needs Discussion to Up Next on the Community-Tech board.

Submitted pull request at https://github.com/wikimedia/wikimedia-ocr/pull/79 which disables the button when the onsubmit event is fired.

I was thinking that optionally a line of status info could be inserted below the button while the form is being submitted, something like:

<div class="submit-status">
    <p class="text-muted">
        <i>Submitting request to OCR engine...</i>
    </p>
</div>

However I'm not sure if this is desired, and wasn't prepared to write all the required translations myself. Any thoughts?

Thanks for the PR :)

As far as the status info message is concerned, I believe we were thinking of adding a loading indicator of sorts when the request is being processed by the OCR engine. The text "Submitting to OCR engine" might not be visible if the transcription takes less than a couple of seconds (like with Tesseract for example)

@Samwilson should we create a separate task and go ahead with this?

P.S. You will not have to write all the translations, you just have to put one message in (say) English in the appropriate file (i18n/en.json in this case), add the required meta data in i18n/qqq.json and it is translated by contributors from TranslateWIki.

I think adding a status message is a great idea (and can be done in this task I think). It could display after say 1 second. That way, if it's submitted quickly it won't appear, and if it's slower there will be some feedback about what's happening.

And that's right about messages (although note that the main message does need to be in en.json, not just any language).

Also, keep in mind what happens if the request is aborted — we wouldn't want the submit button to be disabled in this case (e.g. if someone forgets to select the right engine, clicks submit, and then stop loading in order to change the engine before re-submitting).

Reference for what happens if the request is aborted: https://stackoverflow.com/questions/19537680/is-it-possible-to-detect-html-form-submit-cancelation

Should we re-enable the buttons after a timeout equal to the request timeout already in place?

@Samwilson what do you recommend we do with this ticket?

Samwilson added a subscriber: theprotonade.

I think @theprotonade has it in hand and CommTech can ignore this one. There's a (currently closed) patch https://github.com/wikimedia/wikimedia-ocr/pull/79 that looks reasonably correct.

I'll try finishing it up over the weekend :)

theprotonade changed the task status from Open to In Progress.Wed, Apr 3, 5:57 PM
theprotonade added a project: Patch-For-Review.

Linking the PR

theprotonade claimed this task.
theprotonade removed a project: Patch-For-Review.