Spaces:
Running
Running
!function(){var t,e,n,i,o,s,r,a,u={495:function(){},7147:function(){},1418:function(){},8741:function(){},8386:function(){},3342:function(){},1969:function(t,e,n){"use strict";var i=n(7431),o=n(9078);o.OBj.allowLocalModels=!1;class s{static async getInstance(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null===this.instance&&(this.instance=(0,o.EUT)(this.task,this.model,{quantized:this.quantized,progress_callback:t,revision:this.model.includes("/whisper-medium")?"no_attentions":"main"})),this.instance}constructor(t,e,n){this.tokenizer=t,this.model=e,this.quantized=n}}(0,i._)(s,"task",null),(0,i._)(s,"model",null),(0,i._)(s,"quantized",null),(0,i._)(s,"instance",null),self.addEventListener("message",async t=>{let e=t.data,n=await a(e.audio,e.model,e.multilingual,e.quantized,e.subtask,e.language);null!==n&&self.postMessage({status:"complete",task:"automatic-speech-recognition",data:n})});class r extends s{}(0,i._)(r,"task","automatic-speech-recognition"),(0,i._)(r,"model",null),(0,i._)(r,"quantized",null);let a=async(t,e,n,i,o,s)=>{let a=e.startsWith("distil-whisper/")||e.startsWith("huuquyet"),u=e;a||n||(u+=".en"),(r.model!==u||r.quantized!==i)&&(r.model=u,r.quantized=i,null!==r.instance&&((await r.getInstance()).dispose(),r.instance=null));let c=await r.getInstance(t=>{self.postMessage(t)}),l=c.processor.feature_extractor.config.chunk_length/c.model.config.max_source_positions,f=[{tokens:[],finalised:!1}];return await c(t,{top_k:0,do_sample:!1,chunk_length_s:a?20:30,stride_length_s:a?3:5,language:s,task:o,return_timestamps:!0,force_full_sequences:!1,callback_function:function(t){f[f.length-1].tokens=[...t[0].output_token_ids];let e=c.tokenizer._decode_asr(f,{time_precision:l,return_timestamps:!0,force_full_sequences:!1});self.postMessage({status:"update",task:"automatic-speech-recognition",data:e})},chunk_callback:function(t){let e=f[f.length-1];Object.assign(e,t),e.finalised=!0,t.is_last||f.push({tokens:[],finalised:!1})}}).catch(t=>(self.postMessage({status:"error",task:"automatic-speech-recognition",data:t}),null))}}},c={};function l(t){var e=c[t];if(void 0!==e)return e.exports;var n=c[t]={exports:{}},i=!0;try{u[t](n,n.exports,l),i=!1}finally{i&&delete c[t]}return n.exports}l.m=u,l.x=function(){var t=l.O(void 0,[165,132,193,72,360],function(){return l(1969)});return l.O(t)},t=[],l.O=function(e,n,i,o){if(n){o=o||0;for(var s=t.length;s>0&&t[s-1][2]>o;s--)t[s]=t[s-1];t[s]=[n,i,o];return}for(var r=1/0,s=0;s<t.length;s++){for(var n=t[s][0],i=t[s][1],o=t[s][2],a=!0,u=0;u<n.length;u++)r>=o&&Object.keys(l.O).every(function(t){return l.O[t](n[u])})?n.splice(u--,1):(a=!1,o<r&&(r=o));if(a){t.splice(s--,1);var c=i();void 0!==c&&(e=c)}}return e},n=Object.getPrototypeOf?function(t){return Object.getPrototypeOf(t)}:function(t){return t.__proto__},l.t=function(t,i){if(1&i&&(t=this(t)),8&i||"object"==typeof t&&t&&(4&i&&t.__esModule||16&i&&"function"==typeof t.then))return t;var o=Object.create(null);l.r(o);var s={};e=e||[null,n({}),n([]),n(n)];for(var r=2&i&&t;"object"==typeof r&&!~e.indexOf(r);r=n(r))Object.getOwnPropertyNames(r).forEach(function(e){s[e]=function(){return t[e]}});return s.default=function(){return t},l.d(o,s),o},l.d=function(t,e){for(var n in e)l.o(e,n)&&!l.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},l.f={},l.e=function(t){return Promise.all(Object.keys(l.f).reduce(function(e,n){return l.f[n](t,e),e},[]))},l.u=function(t){return 72===t?"static/chunks/72-b9a6a0da3e447ebd.js":"static/chunks/"+(({132:"6139e184",165:"590caa2a",193:"50bd76a3"})[t]||t)+"."+({132:"f5956607c9895a14",165:"be5af588047a1c85",193:"3d24d573e3ca7a71",360:"47885073fb31529e"})[t]+".js"},l.miniCssF=function(t){},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},l.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},l.tt=function(){return void 0===i&&(i={createScriptURL:function(t){return t}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(i=trustedTypes.createPolicy("nextjs#bundler",i))),i},l.tu=function(t){return l.tt().createScriptURL(t)},l.p="/_next/",o={251:1},l.f.i=function(t,e){o[t]||importScripts(l.tu(l.p+l.u(t)))},r=(s=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push.bind(s),s.push=function(t){var e=t[0],n=t[1],i=t[2];for(var s in n)l.o(n,s)&&(l.m[s]=n[s]);for(i&&i(l);e.length;)o[e.pop()]=1;r(t)},a=l.x,l.x=function(){return Promise.all([165,132,193,72,360].map(l.e,l)).then(a)},_N_E=l.x()}(); |