Spaces:
Running
Running
yizhangliu
commited on
Commit
•
e5c8bfa
1
Parent(s):
127d233
Update app.py
Browse files
app.py
CHANGED
@@ -59,55 +59,60 @@ start_work = """async() => {
|
|
59 |
if (!gradioEl) {
|
60 |
gradioEl = document.querySelector('body > gradio-app');
|
61 |
}
|
62 |
-
|
63 |
if (typeof window['gradioEl'] === 'undefined') {
|
|
|
64 |
window['gradioEl'] = gradioEl;
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
75 |
|
76 |
const page1 = window['gradioEl'].querySelectorAll('#page_1')[0];
|
77 |
const page2 = window['gradioEl'].querySelectorAll('#page_2')[0];
|
78 |
-
|
79 |
page1.style.display = "none";
|
80 |
page2.style.display = "block";
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
111 |
}
|
112 |
|
113 |
return false;
|
|
|
59 |
if (!gradioEl) {
|
60 |
gradioEl = document.querySelector('body > gradio-app');
|
61 |
}
|
62 |
+
console.log('liuyz_1_')
|
63 |
if (typeof window['gradioEl'] === 'undefined') {
|
64 |
+
console.log('liuyz_2_')
|
65 |
window['gradioEl'] = gradioEl;
|
66 |
+
/*
|
67 |
+
tabitems = window['gradioEl'].querySelectorAll('.tabitem');
|
68 |
+
for (var i = 0; i < tabitems.length; i++) {
|
69 |
+
tabitems[i].childNodes[0].children[0].style.display='none';
|
70 |
+
tabitems[i].childNodes[0].children[1].children[0].style.display='none';
|
71 |
+
tabitems[i].childNodes[0].children[1].children[1].children[0].children[1].style.display="none";
|
72 |
+
}
|
73 |
+
tab_demo = window['gradioEl'].querySelectorAll('#tab_demo')[0];
|
74 |
+
tab_demo.style.display = "block";
|
75 |
+
tab_demo.setAttribute('style', 'height: 100%;');
|
76 |
+
*/
|
77 |
|
78 |
const page1 = window['gradioEl'].querySelectorAll('#page_1')[0];
|
79 |
const page2 = window['gradioEl'].querySelectorAll('#page_2')[0];
|
80 |
+
console.log('liuyz_3_')
|
81 |
page1.style.display = "none";
|
82 |
page2.style.display = "block";
|
83 |
+
console.log('liuyz_4_')
|
84 |
+
|
85 |
+
/*
|
86 |
+
window['prevPrompt'] = '';
|
87 |
+
window['doCheckPrompt'] = 0;
|
88 |
+
window['checkPrompt'] = function checkPrompt() {
|
89 |
+
try {
|
90 |
+
texts = window['gradioEl'].querySelectorAll('textarea');
|
91 |
+
text0 = texts[0];
|
92 |
+
text1 = texts[1];
|
93 |
+
if (window['doCheckPrompt'] === 0 && window['prevPrompt'] !== text1.value) {
|
94 |
+
console.log('_____new prompt___[' + text1.value + ']_');
|
95 |
+
window['doCheckPrompt'] = 1;
|
96 |
+
window['prevPrompt'] = text1.value;
|
97 |
+
for (var i = 2; i < texts.length; i++) {
|
98 |
+
setNativeValue(texts[i], text1.value);
|
99 |
+
texts[i].dispatchEvent(new Event('input', { bubbles: true }));
|
100 |
+
}
|
101 |
+
setTimeout(function() {
|
102 |
+
btns = window['gradioEl'].querySelectorAll('button');
|
103 |
+
for (var i = 0; i < btns.length; i++) {
|
104 |
+
if (btns[i].innerText == 'Submit') {
|
105 |
+
btns[i].click();
|
106 |
+
}
|
107 |
+
}
|
108 |
+
window['doCheckPrompt'] = 0;
|
109 |
+
}, 10);
|
110 |
+
}
|
111 |
+
} catch(e) {
|
112 |
+
}
|
113 |
+
}
|
114 |
+
window['checkPrompt_interval'] = window.setInterval("window.checkPrompt()", 100);
|
115 |
+
*/
|
116 |
}
|
117 |
|
118 |
return false;
|