Spaces:
Paused
Paused
bradley6597
commited on
Commit
•
1320bdb
1
Parent(s):
48036a0
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
img_html = '''
|
4 |
+
<img ondragstart="imgChange(event)" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS4n_urpJ9XpwOTdzBVbGvactwHrPagYQrTJPYjxfxLGkSyu7nJZVqRVGAeohnPgKMrnKE&usqp=CAU">
|
5 |
+
'''
|
6 |
+
|
7 |
+
img_js = '''
|
8 |
+
function imgFunc(x){
|
9 |
+
let script = document.createElement('script');
|
10 |
+
script.innerHTML = "function imgChange(event){ event.dataTransfer.setData('DownloadURL', 'image/png:test.png:https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png')}"
|
11 |
+
document.head.appendChild(script);
|
12 |
+
}
|
13 |
+
'''
|
14 |
+
|
15 |
+
with gr.Blocks() as app:
|
16 |
+
with gr.Row():
|
17 |
+
gr.HTML(img_html)
|
18 |
+
app.load(_js = img_js)
|
19 |
+
|
20 |
+
app.launch(debug=True,
|
21 |
+
share=False,
|
22 |
+
height=768,
|
23 |
+
)
|