Spaces:
Sleeping
Sleeping
Update run.py
Browse files
run.py
CHANGED
|
@@ -1,12 +1,23 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
"""
|
| 8 |
|
| 9 |
-
|
| 10 |
-
gr.HTML(value=counter)
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
html = '''
|
| 2 |
+
<button id="my_btn" onclick="click_text()">Hello</button>
|
| 3 |
+
'''
|
| 4 |
|
| 5 |
+
script = '''
|
| 6 |
+
function test(){
|
| 7 |
+
let script = document.createElement('script');
|
| 8 |
+
script.innerHTML = "function click_text(){alert('click')}";
|
| 9 |
+
document.head.appendChild(script);
|
| 10 |
+
}
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
+
'''
|
|
|
|
| 14 |
|
| 15 |
+
with gr.Blocks() as block:
|
| 16 |
+
gr.HTML(html)
|
| 17 |
+
block.load(_js = script)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
block.launch(debug=True,
|
| 21 |
+
share=False)
|
| 22 |
+
|
| 23 |
+
block.close()
|