馃摝[Feature] Support for async job offloading #323
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
closes #320
This adds support for async jobs. What this does is allows you to submit an audio for processing and receive a
job_idwhich you can check back for later.Jobs are cleaned up on two occasions:
https://github.com/syntaxsdev/whisper-asr-webservice/blob/3678d2aff95aff673fd4496e5aa8c2b11c1a6ae6/app/config.py#L56-L59
This means, once a job is processed, you have
Usage
POST

asr/- just set theasync_jobparam totrueExample response:
to retrieve:

GET
asr/{job_id}(new endpoint)Example response:
In this particular example, I used diarization on WhisperX model as well.
If a failure occurs, it will display the status as
failedand also be cleaned at theJOB_CLEANUP_AFTER_READperiod.Other Notes
I've built it with support eventually to expand to async batch jobs, where you can upload multiple files at once (or multiple files into a job) and then eventually kick off the job, which is why the output is structured as such.
I think a separate PR would be warranted for that.
Testing
Test containers:
docker.io/syntaxsdev/whisper-asr-webservice:latestdocker.io/syntaxsdev/whisper-asr-webservice:latest-gpu