romizone commited on
Commit
af3a2de
·
verified ·
1 Parent(s): efdacd7

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -971,6 +971,21 @@ window.stopTranscribeTimer=function(ok){
971
  }
972
  setTimeout(function(){el.className='live-timer';},60000);
973
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
974
  </script>
975
  """
976
 
 
971
  }
972
  setTimeout(function(){el.className='live-timer';},60000);
973
  };
974
+
975
+ /* Auto-stop timer on Gradio error toast */
976
+ new MutationObserver(function(muts){
977
+ muts.forEach(function(m){
978
+ m.addedNodes.forEach(function(n){
979
+ if(n.nodeType===1){
980
+ var isToast=n.classList&&(n.classList.contains('toast-wrap')||n.classList.contains('error'));
981
+ var hasError=n.querySelector&&n.querySelector('.error,.toast-body');
982
+ if((isToast||hasError)&&window._timerInterval){
983
+ window.stopTranscribeTimer(false);
984
+ }
985
+ }
986
+ });
987
+ });
988
+ }).observe(document.body,{childList:true,subtree:true});
989
  </script>
990
  """
991