add doc onload
Browse files
app.py
CHANGED
@@ -157,12 +157,16 @@ API_NAME = 'tts'
|
|
157 |
|
158 |
head = f'''
|
159 |
<script>
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
166 |
</script>
|
167 |
'''
|
168 |
|
|
|
157 |
|
158 |
head = f'''
|
159 |
<script>
|
160 |
+
document.addEventListener('DOMContentLoaded', () => {{
|
161 |
+
console.log('DOM content loaded');
|
162 |
+
if (!localStorage.getItem('debug')) {{
|
163 |
+
console.log('Attaching frontend app');
|
164 |
+
const frontendApp = document.createElement('iframe');
|
165 |
+
frontendApp.src = '/gradio_api/file=./front/dist/index.html';
|
166 |
+
frontendApp.style = 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none; z-index: 999999;';
|
167 |
+
document.body.appendChild(frontendApp);
|
168 |
+
}}
|
169 |
+
}});
|
170 |
</script>
|
171 |
'''
|
172 |
|