@@ -567,7 +567,6 @@ function SampleWidget() {
567567 textArea . style . padding = "15px" ;
568568 textArea . placeholder = randomPrompt ;
569569 textArea . addEventListener ( "input" , function ( ) {
570-
571570 if ( generating ) {
572571 submit . disabled = true ;
573572 preview . disabled = true ;
@@ -593,17 +592,12 @@ function SampleWidget() {
593592 submit . style . cursor = "pointer" ;
594593 submit . innerHTML = "Submit" ;
595594 submit . onclick = async function ( ) {
596-
597595 submit . disabled = true ;
598-
599596 const prompt = textArea . value ;
600597 const encodedPrompt = encodeURIComponent ( prompt ) ;
601598 const url = `http://localhost:8000/generate?prompt=${ encodedPrompt } ` ;
602-
603599 try {
604-
605600 generating = true ;
606-
607601 activity . textMsg ( _ ( "Generating Audio..." ) , 2500 ) ;
608602
609603 let blinkInterval = setInterval ( ( ) => {
@@ -668,7 +662,6 @@ function SampleWidget() {
668662 buttonDiv . appendChild ( preview ) ;
669663 buttonDiv . appendChild ( save ) ;
670664
671-
672665 container . appendChild ( h1 )
673666 container . appendChild ( textArea ) ;
674667 container . appendChild ( buttonDiv ) ;
@@ -730,16 +723,11 @@ function SampleWidget() {
730723
731724 fileChooser . onchange = function ( ) {
732725 const file = fileChooser . files [ 0 ] ;
733-
734726 const audioPlayer = document . createElement ( "audio" ) ;
735-
736727 audioPlayer . controls = true ;
737-
738728 const fileURL = URL . createObjectURL ( file ) ;
739729 audioPlayer . src = fileURL ;
740-
741730 container . replaceChild ( audioPlayer , divUploadSample ) ;
742-
743731 } ;
744732
745733 const inputDiv = document . createElement ( "div" ) ;
@@ -778,12 +766,10 @@ function SampleWidget() {
778766 toInputBox . style . padding = "8px" ;
779767 toInputBox . style . textAlign = "center" ;
780768 toInputBox . type = "number" ;
781-
782769
783770 inputDiv . appendChild ( fromInputBox ) ;
784771 inputDiv . appendChild ( toInputBox ) ;
785772
786-
787773 const buttonDiv = document . createElement ( "div" ) ;
788774 buttonDiv . style . width = "400px" ;
789775 buttonDiv . style . display = "flex" ;
@@ -801,13 +787,10 @@ function SampleWidget() {
801787 preview . onclick = async function ( ) {
802788 const from = fromInputBox . value
803789 const to = toInputBox . value
804-
805790 const audioURL = `http://localhost:8000/trim-preview?start=${ from } &end=${ to } ` ;
806-
807791 const audio = new Audio ( audioURL ) ;
808792 audio . play ( ) ;
809793 save . disabled = false ;
810-
811794 } ;
812795
813796 const save = document . createElement ( "button" ) ;
@@ -836,7 +819,6 @@ function SampleWidget() {
836819 container . appendChild ( divUploadSample ) ;
837820 container . appendChild ( inputDiv ) ;
838821 container . appendChild ( buttonDiv ) ;
839-
840822 } ;
841823
842824 this . _playbackBtn . id = "playbackBtn" ;
0 commit comments