espnet_onnx_demo / static /js /app.35b31ce6.js
ms180's picture
Added several languages
54a30e5
(function(){"use strict";var e={2974:function(e,t,a){var s=a(144),r=a(1096),o=a(3551),n=function(){var e=this,t=e._self._c;return t(r.Z,[t(o.Z,[t("DemoHeader"),t("EspnetOnnxDemo"),t("DemoFooter")],1)],1)},l=[],i=a(3058),u=a(4437),c=a(6035),d=a(5294),h=a(5234),m=function(){var e=this,t=e._self._c;return t(c.Z,[t(i.Z,{staticClass:"mt-4",attrs:{flat:""}},[t(d.Z,[t(u.Z,{attrs:{cols:"3"}},[t("a",{attrs:{href:"https://github.com/espnet/espnet"}},[t("img",{attrs:{src:"https://masao-someki.github.io/espnet_onnx_demo/image/espnet-logo.png",width:"100%"}})])]),t(h.Z),t(u.Z,{staticStyle:{"text-align":"right"},attrs:{cols:"1"}},[t("a",{attrs:{href:"https://github.com/espnet/espnet_onnx"}},[t("img",{attrs:{src:"https://masao-someki.github.io/espnet_onnx_demo/image/github-mark.png",width:"100%"}})])])],1)],1)],1)},p=[],g={name:"DemoHeader",data:()=>({hoverFlag:!1}),methods:{hover(){this.hoverFlag=!0},out(){this.hoverFlag=!1}}},v=g,f=a(1001),_=(0,f.Z)(v,m,p,!1,null,null,null),b=_.exports,y=a(2537),S=function(){var e=this,t=e._self._c;return t(c.Z,[t(y.Z,{attrs:{padless:"",absolute:""}},[t(d.Z,{attrs:{justify:"center","no-gutters":""}},[t(u.Z,{staticClass:"py-4 text-center",attrs:{color:"#BFBFBF",cols:"12"}},[e._v(" "+e._s((new Date).getFullYear())+" — "),t("strong",[e._v("ESPnet-ONNX")])])],1)],1)],1)},w=[],Z={name:"DemoFooter"},x=Z,T=(0,f.Z)(x,S,w,!1,null,null,null),C=T.exports,F=a(5223),A=a(9868),E=function(){var e=this,t=e._self._c;return t(c.Z,[t(i.Z,{attrs:{flat:""}},[t(F.EB,[t("span",{staticClass:"text-h3"},[e._v("ESPnet-ONNX demo")])]),t(F.ZB,{staticClass:"body-1"},[e._v(" This is a demonstration space of ESPnet-ONNX project. Please select ASR or TTS to play! ")])],1),t("MenuBar",{staticClass:"mt-6 mx-auto",attrs:{options:e.options},on:{select:e.menuChanged},model:{value:e.selected,callback:function(t){e.selected=t},expression:"selected"}}),t(A.Z,{staticClass:"mb-10"},[t("div",{directives:[{name:"show",rawName:"v-show",value:"ASR"==e.menuSelected,expression:"menuSelected == 'ASR'"}]},[t("ASRDemoSheet",{staticClass:"mt-3"})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:"TTS"==e.menuSelected,expression:"menuSelected == 'TTS'"}]},[t("TTSDemoSheet",{staticClass:"mt-3"})],1)])],1)},k=[],D=a(5057),L=function(){var e=this,t=e._self._c;return t("div",{staticClass:"btn-containrt_foreground",style:e.cssVariables},[t("div",{staticClass:"btn-containrt"},e._l(e.localOptions,(function(a,s){return t("div",{key:`menu-label-${s}`,class:{[`btn-item-${s} labels`]:!0,["checked"]:a.isActive,["unchecked"]:!a.isActive},on:{click:function(t){return e.handleLabelClick(a)}}},[t("div",{staticClass:"active-label"},[a.badge?t("div",{staticClass:"btn-badge"},[e._v(" "+e._s(a.badge)+" ")]):e._e(),e.hasSlot("icon")?e._t("icon",null,{props:a}):[t(D.Z,[e._v(" "+e._s(a.icon)+" ")])]],2),t("div",{staticClass:"btn-title"},[e.hasSlot("title")?e._t("title",null,{props:a}):[e._v(" "+e._s(a.title)+" ")]],2)])})),0)])},R=[],O={model:{prop:"value",event:"update"},props:{value:{default:null},options:{type:Array,default:()=>[]},badgeColor:{type:String,default:"#FBC02D"}},data:()=>({localOptions:[],showable:!1}),created(){this.localOptions=this.options.map((e=>({...e,isActive:this.isActive(e)})))},computed:{cssVariables(){return{"--color-badge":this.badgeColor}},hasActiveClass(){return this.localOptions.some((e=>e.isActive))}},methods:{handleLabelClick(e){this.showable||this.toggleClass(),this.updateValue(e.id),this.$emit("select",e.title)},updateValue(e){this.localOptions.forEach((t=>t.isActive=this.isActive(t,e))),this.$emit("update",e)},toggleClass(){this.showable=!this.showable},isActive(e,t=this.value){return e.id==t||(e.childs||[]).find((e=>e.id==t))},hasSlot(e){return this.$slots[e]||this.$scopedSlots[e]}}},P=O,M=(0,f.Z)(P,L,R,!1,null,"002ef1c4",null),j=M.exports,B=a(4635),I=a(1828),H=a(6938),N=a(4397),V=a(5617),$=function(){var e=this,t=e._self._c;return t(c.Z,[t(A.Z,{staticClass:"mt-6 mx-3"},[t(d.Z,[t(u.Z,{staticClass:"py-auto",staticStyle:{"text-align":"center"},attrs:{cols:"3",height:"100%"}},[t("span",{staticClass:"text-h6"},[e._v(" Language ")])]),t(u.Z,{attrs:{cols:"7"}},[t(H.Z,{attrs:{items:e.models,error:e.selectError,"auto-select-first":"",dense:""},model:{value:e.lang,callback:function(t){e.lang=t},expression:"lang"}})],1),t(u.Z,{attrs:{cols:"2"}},[t(I.Z,{attrs:{outlined:"",width:"100%",loading:e.loadingFlag},on:{click:e.loadModel}},[e._v(" Load ")])],1)],1),t(d.Z,[t(u.Z,{staticClass:"py-auto",staticStyle:{"text-align":"center"},attrs:{cols:"3",height:"100%"}},[t("div",{staticClass:"my-auto"},[t("span",{staticClass:"text-h6"},[e._v(" Upload audio ")])])]),t(u.Z,{attrs:{cols:"7"}},[t("audio-recorder",{staticStyle:{"box-shadow":"none",background:"none"},attrs:{attempts:3,time:1,"sample-rate":"16000","show-download-button":!1,"show-upload-button":!1,format:"mp3","select-record":e.selectRecord,"after-recording":e.afterRecord}})],1),t(u.Z,{staticClass:"d-flex flex-column",attrs:{cols:"2"}},[t(h.Z),t(I.Z,{staticClass:"mt-auto",attrs:{outlined:"",width:"100%",loading:e.ASRLoadingFlag},on:{click:e.runModel}},[e._v(" Run ")])],1)],1),t(d.Z,[t(u.Z,{staticClass:"py-auto",staticStyle:{"text-align":"center"},attrs:{cols:"3",height:"100%"}},[t("span",{staticClass:"text-h6"},[e._v(" Text ")])]),t(u.Z,{attrs:{cols:"9"}},[t(V.Z,{attrs:{dense:"",readonly:""},model:{value:e.text,callback:function(t){e.text=t},expression:"text"}})],1)],1),t(d.Z,{staticClass:"mt-6"},[t(u.Z,{staticClass:"py-auto",staticStyle:{"text-align":"center"},attrs:{cols:"3",height:"100%"}},[t("span",{staticClass:"text-h6"},[e._v(" Detail ")])]),t(u.Z,{attrs:{cols:"9"}},[t(i.Z,{attrs:{flat:""}},[t(N.Z,[t("tbody",e._l(e.modelInfo[e.lang],(function(a){return t("tr",{key:a.name},[t("td",[e._v(e._s(a.name))]),a.url?t("td",[t("a",{attrs:{href:a.url}},[e._v(e._s(a.value))])]):t("td",[e._v(e._s(a.value))])])})),0)])],1)],1)],1)],1),t(B.Z,{attrs:{value:e.showAlert,type:e.barType,"colored-border":"",border:"top",elevation:"2"}},[e._v(" "+e._s(e.message))])],1)},z=[],G=a(6154);const J={English:[{name:"dataset",value:"Librispeech 960h",url:"https://www.openslr.org/12"},{name:"tag",value:"asapp/e_branchformer_librispeech",url:"https://huggingface.co/asapp/e_branchformer_librispeech"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"E-Branchformer(17)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"result",url:"https://github.com/espnet/espnet/tree/master/egs2/librispeech/asr1#e-branchformer"}],Bengali:[{name:"dataset",value:"Large bengali ASR training dataset",url:"https://openslr.org/53/"},{name:"tag",value:"espnet/bn_openslr53",url:"https://huggingface.co/espnet/bn_openslr53"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"Transformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"results",url:"https://github.com/espnet/espnet/tree/master/egs2/bn_openslr53/asr1#results"}],Chinese:[{name:"dataset",value:"AISHELL-ASR0009-OS1 Open Source Mandarin Speech Corpus",url:"https://www.aishelltech.com/kysjcp"},{name:"tag",value:"pyf98/aishell_e_branchformer",url:"https://huggingface.co/pyf98/aishell_e_branchformer"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"E-Branchformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"branchformer-initial",url:"https://github.com/espnet/espnet/tree/master/egs2/aishell/asr1#branchformer-initial"}],French:[{name:"dataset",value:"Swiss French Polyphone corpus",url:"http://catalog.elra.info/en-us/repository/browse/ELRA-S0030_02/"},{name:"tag",value:"adolfvonkleist/polyphone_swiss_french_asr_train_asr_conformer_raw_bpe800_sp_valid.acc.ave",url:"https://zenodo.org/record/4319575#.ZGOSDJHP1H4"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"Conformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"asr_train_asr_conformer_raw_bpe800_spl",url:"https://github.com/espnet/espnet/tree/master/egs2/polyphone_swiss_french/asr1#asr_train_asr_conformer_raw_bpe800_spl"}],Nahuatl:[{name:"dataset",value:"Highland Puebla Nahuatl corpus (endangered language in central Mexico)",url:"https://www.openslr.org/92/"},{name:"tag",value:"espnet/ftshijt_espnet2_asr_puebla_nahuatl_transfer",url:"https://huggingface.co/espnet/ftshijt_espnet2_asr_puebla_nahuatl_transfer"},{name:"Frontend",value:"HuBERT"},{name:"Encoder",value:"Transformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"result",url:"https://github.com/espnet/espnet/blob/master/egs2/puebla_nahuatl/asr1/RESULTS.md#result"}],Japanese:[{name:"dataset",value:"Japanese speech corpus of Saruwatari-lab., University of Tokyo",url:"https://sites.google.com/site/shinnosuketakamichi/publication/jsut"},{name:"tag",value:"pyf98/jsut_e_branchformer",url:"https://huggingface.co/pyf98/jsut_e_branchformer"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"E-Branchformer(16)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"e-branchformer",url:"https://github.com/espnet/espnet/tree/master/egs2/jsut/asr1#e-branchformer"}],Korean:[{name:"dataset",value:"KsponSpeech (Korean spontaneous speech) corpus",url:"https://aihub.or.kr/aihubdata/data/view.do?currMenu=115&topMenu=100&aihubDataSe=realm&dataSetSn=123"},{name:"tag",value:"Yushi Ueda/ksponspeech_asr_train_asr_conformer8_n_fft512_hop_length256_raw_kr_bpe2309_valid.acc.best",url:"https://zenodo.org/record/5154341#.ZGOV9pHP1H4"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"Conformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"conformertransformer-lm",url:"https://github.com/espnet/espnet/tree/master/egs2/ksponspeech/asr1#conformertransformer-lm"}],Russian:[{name:"dataset",value:"Russian Open Speech To Text (STT/ASR) Dataset",url:"https://github.com/snakers4/open_stt"},{name:"tag",value:"Pavel Denisov/ru_open_stt_asr_train_asr_conformer_raw_ru_bpe100_valid.acc.ave",url:"https://zenodo.org/record/4541727#.ZGOZBJHP1H4"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"Conformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"the-first-conformer-result",url:"https://github.com/espnet/espnet/tree/master/egs2/ru_open_stt/asr1#the-first-conformer-result"}],Sinhala:[{name:"dataset",value:"Sinhala speech recognition corpus",url:"https://drive.google.com/file/d/17_e0JhMW4_FPxfh93foplnxb4OQp8zh3/view"},{name:"tag",value:"espnet/Karthik_sinhala_asr_train_asr_transformer",url:"https://huggingface.co/espnet/Karthik_sinhala_asr_train_asr_transformer"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"Conformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"result",url:"https://github.com/espnet/espnet/tree/master/egs2/sinhala/asr1#using-transformer-based-encoder-decoder-predicting-transcript-along-with-intent"}],Sundanese:[{name:"dataset",value:"Large Sundanese ASR training data set",url:"http://www.openslr.org/36"},{name:"tag",value:"su_openslr36",url:"https://zenodo.org/record/5090135#.ZGOacJHP1H4"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"Conformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"result",url:"https://github.com/espnet/espnet/tree/master/egs2/su_openslr36/asr1#results"}],Totonac:[{name:"dataset",value:"Highland Totonac corpus (endangered language in central Mexico)",url:"http://www.openslr.org/107/"},{name:"tag",value:"espnet/ftshijt_espnet2_asr_totonac_transformer",url:"https://huggingface.co/espnet/ftshijt_espnet2_asr_totonac_transformer"},{name:"Frontend",value:"DefaultFrontend"},{name:"Encoder",value:"Conformer(12)"},{name:"Decoder",value:"Transformer(6)"},{name:"Metrics",value:"result",url:"https://github.com/espnet/espnet/blob/master/egs2/totonac/asr1/RESULTS.md#results"}]};console.log(J);var K={name:"ASRDemoSheet",data:()=>({lang:"",models:Object.keys(J),modelInfo:J,loadingFlag:!1,text:"",ASRLoadingFlag:!1,showAlert:!1,message:"",barType:"success",selectError:!1,audioFile:"",audioError:!1,soundSrc:[],record:null}),methods:{hide_alert:function(){window.setInterval((()=>{this.showAlert=!1}),3e3)},loadModel(){if(this.loadingFlag=!0,""===this.lang||!this.models.includes(this.lang))return this.showAlert=!0,this.selectError=!0,this.message="Please select a language from list",this.loadingFlag=!1,this.barType="error",void this.hide_alert();this.selectError=!1,G.Z.get("/api/asr/load_model",{params:{model_name:this.modelInfo[this.lang][1].value}}).then((()=>{this.message="Successfully loaded model",this.barType="success",this.loadingFlag=!1,this.alert=!0,this.modelLoaded=!0,this.showAlert=!0,this.hide_alert()})).catch((e=>{this.message="Error happened while loading model",this.loadingFlag=!1,this.alert=!0,this.barType="error",this.showAlert=!0,this.hide_alert(),console.log(e)}))},runModel(){if(this.ASRLoadingFlag=!0,!this.modelLoaded)return this.showAlert=!0,this.selectError=!0,this.message="Please load a model before generating audio.",this.ASRLoadingFlag=!1,this.barType="error",void this.hide_alert();if(!this.record)return this.showAlert=!0,this.audioError=!0,this.message="Please record at least one audio.",this.ASRLoadingFlag=!1,this.barType="error",void this.hide_alert();let e=new FormData;e.append("audio",this.record.blob,`${this.record.filename}.mp3`),G.Z.post("/api/asr/recognize",e,{headers:{"Content-Type":"multipart/form-data"}}).then((e=>{this.message="Recognition finished.",this.barType="success",this.ASRLoadingFlag=!1,this.alert=!0,this.text=e.data.text,this.hide_alert()})).catch((e=>{this.message="Error happened while executing model",this.ASRLoadingFlag=!1,this.alert=!0,this.barType="error",this.hide_alert(),console.log(e)}))},selectRecord(e){this.record=e},afterRecord(e){this.record=e}}},U=K,X=(0,f.Z)(U,$,z,!1,null,null,null),W=X.exports,Y=a(5731),Q=function(){var e=this,t=e._self._c;return t(c.Z,[t(A.Z,{staticClass:"mt-6 mx-3"},[t(d.Z,[t(u.Z,{staticClass:"py-auto",staticStyle:{"text-align":"center"},attrs:{cols:"3",height:"100%"}},[t("span",{staticClass:"text-h6"},[e._v(" Select model ")])]),t(u.Z,{attrs:{cols:"7"}},[t(Y.Z,{attrs:{items:e.models,dense:"",error:e.selectError},model:{value:e.model,callback:function(t){e.model=t},expression:"model"}})],1),t(u.Z,{attrs:{cols:"2"}},[t(I.Z,{attrs:{outlined:"",width:"100%",loading:e.loadingFlag},on:{click:e.loadModel}},[e._v(" Load ")])],1)],1),t(d.Z,[t(u.Z,{staticClass:"py-auto",staticStyle:{"text-align":"center"},attrs:{cols:"3",height:"100%"}},[t("span",{staticClass:"text-h6"},[e._v(" Write text ")])]),t(u.Z,{attrs:{cols:"7"}},[t(V.Z,{attrs:{dense:"",clearable:"",rows:"2",counter:"",error:e.textError,rules:e.textLengthRules},model:{value:e.text,callback:function(t){e.text=t},expression:"text"}})],1),t(u.Z,{attrs:{cols:"2"}},[t(I.Z,{attrs:{outlined:"",width:"100%",loading:e.TTSLoadingFlag},on:{click:e.runModel}},[e._v(" Generate ")])],1)],1),t(d.Z,[t(u.Z,{staticClass:"py-auto",staticStyle:{"text-align":"center"},attrs:{cols:"3",height:"100%"}},[t("span",{staticClass:"text-h6"},[e._v(" Generated audio ")])]),t(u.Z,{attrs:{cols:"9"}},[t("AudioPlayer",{ref:"audioPlayer"})],1)],1),t(d.Z,{staticClass:"mt-6"},[t(u.Z,{staticClass:"py-auto",staticStyle:{"text-align":"center"},attrs:{cols:"3",height:"100%"}},[t("span",{staticClass:"text-h6"},[e._v(" Model Detail ")])]),t(u.Z,{attrs:{cols:"9"}},[t(i.Z,{attrs:{flat:""}},[t(N.Z,[t("tbody",e._l(e.modelInfo[e.model],(function(a){return t("tr",{key:a.name},[t("td",[e._v(e._s(a.name))]),t("td",[e._v(e._s(a.value))])])})),0)])],1)],1)],1)],1),t(B.Z,{attrs:{value:e.showAlert,type:e.barType,"colored-border":"",border:"top",elevation:"2"}},[e._v(" "+e._s(e.message))])],1)},q=[],ee=a(2059),te=function(){var e=this,t=e._self._c;return t("div",{staticClass:"player"},[t(d.Z,{staticClass:"player-controls ma-0"},[t(u.Z,{staticClass:"pa-2",staticStyle:{"text-align":"center"},attrs:{cols:"1",title:"Stop"}},[t(I.Z,{attrs:{icon:""},on:{click:e.stop}},[t(D.Z,[e._v("mdi-stop")])],1)],1),t(u.Z,{staticClass:"pa-2",staticStyle:{"text-align":"center"},attrs:{cols:"1",title:"Play/Pause"}},[t(I.Z,{attrs:{icon:""},on:{click:function(t){e.playing=!e.playing}}},[t(D.Z,{directives:[{name:"show",rawName:"v-show",value:!e.playing,expression:"!playing"}]},[e._v("mdi-play")]),t(D.Z,{directives:[{name:"show",rawName:"v-show",value:e.playing,expression:"playing"}]},[e._v("mdi-pause")])],1)],1),t(u.Z,{staticClass:"pa-0",attrs:{cols:"6"}},[t("div",{staticClass:"player-progress",attrs:{title:"Time played : Total time"},on:{click:e.seek}},[t("div",{staticClass:"player-seeker",style:{width:this.percentComplete+"%"}})]),t("div",{staticClass:"player-time"},[t("div",{staticClass:"player-time-current"},[e._v(e._s(e.currentTime))]),t("div",{staticClass:"player-time-total"},[e._v(e._s(e.durationTime))])])]),t(u.Z,{staticClass:"pa-2",staticStyle:{"text-align":"center"},attrs:{cols:"4"}},[t(ee.Z,{attrs:{"prepend-icon":"mdi-volume-high",max:"100",width:"100%",dense:"","hide-details":"auto"},model:{value:e.volume,callback:function(t){e.volume=t},expression:"volume"}})],1)],1)],1)},ae=[];const se=e=>{let t=new Date(1e3*e).toISOString().substr(11,8);return 0===t.indexOf("00:")?t.substr(3):t};var re={name:"ASRDemoSheet",props:{file:{type:String,default:null},autoPlay:{type:Boolean,default:!1},loop:{type:Boolean,default:!1}},data:()=>({audio:void 0,currentSeconds:0,durationSeconds:0,innerLoop:!1,loaded:!1,playing:!1,previousVolume:35,showVolume:!1,volume:100}),computed:{currentTime(){return se(this.currentSeconds)},durationTime(){return se(this.durationSeconds)},percentComplete(){return parseInt(this.currentSeconds/this.durationSeconds*100)},muted(){return this.volume/100===0}},watch:{playing(e){if(e)return this.audio.play();this.audio.pause()},volume(){this.showVolume=!1,this.audio.volume=this.volume/100}},methods:{download(){this.stop(),window.open(this.file,"download")},load(){if(this.audio.readyState>=2)return this.loaded=!0,this.durationSeconds=parseInt(this.audio.duration),this.playing=this.autoPlay;throw new Error("Failed to load sound file.")},mute(){if(this.muted)return this.volume=this.previousVolume;this.previousVolume=this.volume,this.volume=0},seek(e){if(!this.playing||"SPAN"===e.target.tagName)return;const t=e.target.getBoundingClientRect(),a=(e.clientX-t.left)/t.width;this.audio.currentTime=parseInt(this.audio.duration*a)},stop(){this.playing=!1,this.audio.currentTime=0},update(){this.currentSeconds=parseInt(this.audio.currentTime)},reload(){this.audio=new Audio("/static/sample.wav"),this.audio.addEventListener("timeupdate",this.update),this.audio.addEventListener("loadeddata",this.load),this.audio.addEventListener("pause",(()=>{this.playing=!1})),this.audio.addEventListener("play",(()=>{this.playing=!0})),this.playing=!1,this.durationSeconds=parseInt(this.audio.duration)}},created(){this.innerLoop=this.loop}},oe=re,ne=(0,f.Z)(oe,te,ae,!1,null,null,null),le=ne.exports,ie={name:"ASRDemoSheet",components:{AudioPlayer:le},data:()=>({model:"",models:["kan-bayashi/ljspeech_vits"],modelInfo:{"kan-bayashi/ljspeech_vits":[{name:"url",value:"https://huggingface.co/espnet/kan-bayashi_ljspeech_vits"},{name:"model",value:"VITS"},{name:"sample_rate",value:22050}]},counter:{max:20},loadingFlag:!1,text:"",TTSLoadingFlag:!1,textLengthRules:[e=>e.length<=100||"Maximum 100 characters allowed"],showAlert:!1,message:"",modelLoaded:!1,textError:!1,barType:"success",selectError:!1}),methods:{hide_alert:function(){window.setInterval((()=>{this.showAlert=!1}),3e3)},loadModel:function(){if(this.loadingFlag=!0,""===this.model)return this.showAlert=!0,this.selectError=!0,this.message="Please select a model",this.loadingFlag=!1,this.barType="error",void this.hide_alert();this.selectError=!1,G.Z.get("/api/tts/load_model",{params:{model_name:this.model,fs:this.modelInfo[this.model][2].value}}).then((()=>{this.message="Successfully loaded model",this.barType="success",this.loadingFlag=!1,this.alert=!0,this.modelLoaded=!0,this.showAlert=!0,this.hide_alert()})).catch((e=>{this.message="Error happened while loading model",this.loadingFlag=!1,this.alert=!0,this.barType="error",this.showAlert=!0,this.hide_alert(),console.log(e)}))},runModel:function(){return this.TTSLoadingFlag=!0,this.modelLoaded?this.text?(this.selectError=!1,void G.Z.post("/api/tts/generate",{text:this.text}).then((()=>{this.message="Successfully generated audio",this.barType="success",this.TTSLoadingFlag=!1,this.alert=!0,this.hide_alert(),this.$refs.audioPlayer.reload()})).catch((e=>{this.message="Error happened while loading model",this.TTSLoadingFlag=!1,this.alert=!0,this.barType="error",this.hide_alert(),console.log(e)}))):(this.showAlert=!0,this.textError=!0,this.message="Please write text.",this.TTSLoadingFlag=!1,this.barType="error",void this.hide_alert()):(this.showAlert=!0,this.selectError=!0,this.message="Please load a model before generating audio.",this.TTSLoadingFlag=!1,this.barType="error",void this.hide_alert())}}},ue=ie,ce=(0,f.Z)(ue,Q,q,!1,null,null,null),de=ce.exports,he={name:"EspnetOnnxDemo",components:{MenuBar:j,ASRDemoSheet:W,TTSDemoSheet:de},data:()=>({selected:1,options:[{id:1,icon:"mdi-microphone-message",title:"ASR"},{id:2,icon:"mdi-speaker-message",title:"TTS"}],menuSelected:"ASR"}),methods:{menuChanged:function(e){this.menuSelected!=e&&(this.menuSelected=e)}}},me=he,pe=(0,f.Z)(me,E,k,!1,null,null,null),ge=pe.exports,ve={name:"App",components:{DemoHeader:b,DemoFooter:C,EspnetOnnxDemo:ge}},fe=ve,_e=(0,f.Z)(fe,n,l,!1,null,null,null),be=_e.exports,ye=a(2250);s.ZP.use(ye.Z);var Se=new ye.Z({}),we=a(579),Ze=a.n(we);s.ZP.use(Ze()),s.ZP.config.productionTip=!1,new s.ZP({vuetify:Se,render:e=>e(be)}).$mount("#app")}},t={};function a(s){var r=t[s];if(void 0!==r)return r.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,a),o.exports}a.m=e,function(){var e=[];a.O=function(t,s,r,o){if(!s){var n=1/0;for(c=0;c<e.length;c++){s=e[c][0],r=e[c][1],o=e[c][2];for(var l=!0,i=0;i<s.length;i++)(!1&o||n>=o)&&Object.keys(a.O).every((function(e){return a.O[e](s[i])}))?s.splice(i--,1):(l=!1,o<n&&(n=o));if(l){e.splice(c--,1);var u=r();void 0!==u&&(t=u)}}return t}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[s,r,o]}}(),function(){a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,{a:t}),t}}(),function(){a.d=function(e,t){for(var s in t)a.o(t,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}}(),function(){a.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){var e={143:0};a.O.j=function(t){return 0===e[t]};var t=function(t,s){var r,o,n=s[0],l=s[1],i=s[2],u=0;if(n.some((function(t){return 0!==e[t]}))){for(r in l)a.o(l,r)&&(a.m[r]=l[r]);if(i)var c=i(a)}for(t&&t(s);u<n.length;u++)o=n[u],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return a.O(c)},s=self["webpackChunkespnet_onnx_demo"]=self["webpackChunkespnet_onnx_demo"]||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))}();var s=a.O(void 0,[998],(function(){return a(2974)}));s=a.O(s)})();
//# sourceMappingURL=app.35b31ce6.js.map