Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1066,45 +1066,43 @@ async () => {{
|
|
1066 |
const days = {opt.run_time};
|
1067 |
|
1068 |
const gradioEl = document.querySelector('body > gradio-app');
|
1069 |
-
console.log(gradioEl);
|
1070 |
-
var $ = gradioEl.querySelector;
|
1071 |
|
1072 |
var deadlineAnimation = function () {{
|
1073 |
setTimeout(function() {{
|
1074 |
-
|
1075 |
}}, 0);
|
1076 |
|
1077 |
setTimeout(function() {{
|
1078 |
-
|
1079 |
}}, {int((opt.run_time + opt.prep_time) * 1000 * 0.2)});
|
1080 |
|
1081 |
setTimeout(function() {{
|
1082 |
-
|
1083 |
}}, {int((opt.run_time + opt.prep_time) * 1000 * 0.4)});
|
1084 |
|
1085 |
setTimeout(function() {{
|
1086 |
-
|
1087 |
}}, {int((opt.run_time + opt.prep_time) * 1000 * 0.6)});
|
1088 |
|
1089 |
setTimeout(function() {{
|
1090 |
-
|
1091 |
}}, {int((opt.run_time + opt.prep_time) * 1000 * 0.75)});
|
1092 |
}};
|
1093 |
|
1094 |
var deadlineTextBegin = function () {{
|
1095 |
-
var el =
|
1096 |
var html = 'Preparing...';
|
1097 |
el.html(html);
|
1098 |
}};
|
1099 |
|
1100 |
var deadlineTextFinished = function () {{
|
1101 |
-
var el =
|
1102 |
var html = 'Done! Retry?';
|
1103 |
el.html(html);
|
1104 |
}};
|
1105 |
|
1106 |
var deadlineText = function (remainingTime) {{
|
1107 |
-
var el =
|
1108 |
var htmlBase = 'Remaining <span class="day">' + remainingTime + '</span> <span class="days">s</span>';
|
1109 |
el.html(html);
|
1110 |
var html = '<div class="mask-red"><div class="inner">' + htmlBase + '</div></div><div class="mask-white"><div class="inner">' + htmlBase + '</div></div>';
|
@@ -1124,25 +1122,25 @@ async () => {{
|
|
1124 |
deadlineTextBegin();
|
1125 |
}} else if (actualDay > 0) {{
|
1126 |
deadlineText(actualDay);
|
1127 |
-
//
|
1128 |
}} else {{
|
1129 |
clearInterval(timer);
|
1130 |
-
//
|
1131 |
deadlineTextFinished();
|
1132 |
}}
|
1133 |
}}
|
1134 |
}}
|
1135 |
|
1136 |
-
var imgSrc1 =
|
1137 |
console.log(imgSrc1);
|
1138 |
|
1139 |
var runAnimation = function() {{
|
1140 |
-
var imgSrc =
|
1141 |
var state = false;
|
1142 |
var timerMain = setInterval(checkAndRun, 250);
|
1143 |
|
1144 |
function checkAndRun() {{
|
1145 |
-
var imgSrcNew =
|
1146 |
|
1147 |
console.log('state', state, 'src', imgSrc, 'src_new', imgSrcNew);
|
1148 |
if (!state) {{
|
@@ -1154,7 +1152,7 @@ async () => {{
|
|
1154 |
state = true;
|
1155 |
|
1156 |
// Run the main animation just once.
|
1157 |
-
|
1158 |
timer(animationTime, days);
|
1159 |
deadlineAnimation();
|
1160 |
deadlineText({opt.run_time});
|
|
|
1066 |
const days = {opt.run_time};
|
1067 |
|
1068 |
const gradioEl = document.querySelector('body > gradio-app');
|
|
|
|
|
1069 |
|
1070 |
var deadlineAnimation = function () {{
|
1071 |
setTimeout(function() {{
|
1072 |
+
gradioEl.querySelector('#designer-arm-grop').css({{'animation-duration': '1.5s'}});
|
1073 |
}}, 0);
|
1074 |
|
1075 |
setTimeout(function() {{
|
1076 |
+
gradioEl.querySelector('#designer-arm-grop').css({{'animation-duration': '1.0s'}});
|
1077 |
}}, {int((opt.run_time + opt.prep_time) * 1000 * 0.2)});
|
1078 |
|
1079 |
setTimeout(function() {{
|
1080 |
+
gradioEl.querySelector('#designer-arm-grop').css({{'animation-duration': '0.7s'}});
|
1081 |
}}, {int((opt.run_time + opt.prep_time) * 1000 * 0.4)});
|
1082 |
|
1083 |
setTimeout(function() {{
|
1084 |
+
gradioEl.querySelector('#designer-arm-grop').css({{'animation-duration': '0.3s'}});
|
1085 |
}}, {int((opt.run_time + opt.prep_time) * 1000 * 0.6)});
|
1086 |
|
1087 |
setTimeout(function() {{
|
1088 |
+
gradioEl.querySelector('#designer-arm-grop').css({{'animation-duration': '0.2s'}});
|
1089 |
}}, {int((opt.run_time + opt.prep_time) * 1000 * 0.75)});
|
1090 |
}};
|
1091 |
|
1092 |
var deadlineTextBegin = function () {{
|
1093 |
+
var el = gradioEl.querySelector('.deadline-timer');
|
1094 |
var html = 'Preparing...';
|
1095 |
el.html(html);
|
1096 |
}};
|
1097 |
|
1098 |
var deadlineTextFinished = function () {{
|
1099 |
+
var el = gradioEl.querySelector('.deadline-timer');
|
1100 |
var html = 'Done! Retry?';
|
1101 |
el.html(html);
|
1102 |
}};
|
1103 |
|
1104 |
var deadlineText = function (remainingTime) {{
|
1105 |
+
var el = gradioEl.querySelector('.deadline-timer');
|
1106 |
var htmlBase = 'Remaining <span class="day">' + remainingTime + '</span> <span class="days">s</span>';
|
1107 |
el.html(html);
|
1108 |
var html = '<div class="mask-red"><div class="inner">' + htmlBase + '</div></div><div class="mask-white"><div class="inner">' + htmlBase + '</div></div>';
|
|
|
1122 |
deadlineTextBegin();
|
1123 |
}} else if (actualDay > 0) {{
|
1124 |
deadlineText(actualDay);
|
1125 |
+
// gradioEl.querySelector('.deadline-timer .day').text(actualDay - {opt.prep_time});
|
1126 |
}} else {{
|
1127 |
clearInterval(timer);
|
1128 |
+
// gradioEl.querySelector('.deadline-timer .day').text(deadline);
|
1129 |
deadlineTextFinished();
|
1130 |
}}
|
1131 |
}}
|
1132 |
}}
|
1133 |
|
1134 |
+
var imgSrc1 = gradioEl.querySelector('#output-screen > button > div > img').src;
|
1135 |
console.log(imgSrc1);
|
1136 |
|
1137 |
var runAnimation = function() {{
|
1138 |
+
var imgSrc = gradioEl.querySelector('#output-screen > button > div > img').src;
|
1139 |
var state = false;
|
1140 |
var timerMain = setInterval(checkAndRun, 250);
|
1141 |
|
1142 |
function checkAndRun() {{
|
1143 |
+
var imgSrcNew = gradioEl.querySelector('#output-screen > button > div > img').src;
|
1144 |
|
1145 |
console.log('state', state, 'src', imgSrc, 'src_new', imgSrcNew);
|
1146 |
if (!state) {{
|
|
|
1152 |
state = true;
|
1153 |
|
1154 |
// Run the main animation just once.
|
1155 |
+
gradioEl.querySelector('#progress-time-fill, #death-group').css({{'animation-duration': animationTime+'s'}});
|
1156 |
timer(animationTime, days);
|
1157 |
deadlineAnimation();
|
1158 |
deadlineText({opt.run_time});
|