Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -983,30 +983,41 @@ window.stopTranscribeTimer=function(ok){
|
|
| 983 |
},60000);
|
| 984 |
};
|
| 985 |
|
| 986 |
-
/* Auto-start timer
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
|
|
|
|
|
|
|
|
|
| 990 |
new MutationObserver(function(muts){
|
| 991 |
muts.forEach(function(m){
|
| 992 |
-
m.
|
| 993 |
-
|
| 994 |
-
/*
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 999 |
}
|
| 1000 |
-
/*
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
if((isToast||hasError)&&window._timerInterval){
|
| 1004 |
-
window.stopTranscribeTimer(false);
|
| 1005 |
}
|
| 1006 |
-
}
|
| 1007 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1008 |
});
|
| 1009 |
-
}).observe(document.body,{childList:true,subtree:true});
|
| 1010 |
</script>
|
| 1011 |
"""
|
| 1012 |
|
|
|
|
| 983 |
},60000);
|
| 984 |
};
|
| 985 |
|
| 986 |
+
/* Auto-start timer when EXPLICIT progress() text appears (contains β³).
|
| 987 |
+
Gradio StatusTracker (.eta-bar, .progress-level) appears on ALL fn calls,
|
| 988 |
+
but our β³ marker only appears when progress(0.05,"β³ Menunggu GPU...") is called,
|
| 989 |
+
which happens AFTER the audio_file validation passes.
|
| 990 |
+
- No file β gr.Error() before progress() β no β³ β timer never starts
|
| 991 |
+
- File OK β progress(0.05,"β³...") β β³ detected β timer starts
|
| 992 |
+
Auto-stop on error toast. */
|
| 993 |
new MutationObserver(function(muts){
|
| 994 |
muts.forEach(function(m){
|
| 995 |
+
if(m.type==='childList'){
|
| 996 |
+
m.addedNodes.forEach(function(n){
|
| 997 |
+
/* Element node: check text for β³ marker */
|
| 998 |
+
if(n.nodeType===1){
|
| 999 |
+
if(!window._timerInterval&&n.textContent&&n.textContent.indexOf('\u23f3')!==-1){
|
| 1000 |
+
window.startTranscribeTimer();
|
| 1001 |
+
}
|
| 1002 |
+
/* Detect error toast β stop timer */
|
| 1003 |
+
var isToast=n.classList&&(n.classList.contains('toast-wrap')||n.classList.contains('error'));
|
| 1004 |
+
var hasError=n.querySelector&&n.querySelector('.error,.toast-body');
|
| 1005 |
+
if((isToast||hasError)&&window._timerInterval){
|
| 1006 |
+
window.stopTranscribeTimer(false);
|
| 1007 |
+
}
|
| 1008 |
}
|
| 1009 |
+
/* Text node with β³ */
|
| 1010 |
+
if(n.nodeType===3&&!window._timerInterval&&n.nodeValue&&n.nodeValue.indexOf('\u23f3')!==-1){
|
| 1011 |
+
window.startTranscribeTimer();
|
|
|
|
|
|
|
| 1012 |
}
|
| 1013 |
+
});
|
| 1014 |
+
}
|
| 1015 |
+
/* Text content change containing β³ (progress update on existing node) */
|
| 1016 |
+
if(m.type==='characterData'&&!window._timerInterval&&m.target.nodeValue&&m.target.nodeValue.indexOf('\u23f3')!==-1){
|
| 1017 |
+
window.startTranscribeTimer();
|
| 1018 |
+
}
|
| 1019 |
});
|
| 1020 |
+
}).observe(document.body,{childList:true,subtree:true,characterData:true});
|
| 1021 |
</script>
|
| 1022 |
"""
|
| 1023 |
|