vision-arena / index.html
yuchenlin's picture
Update index.html
05080c5 verified
raw
history blame
2.46 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gradio App Iframe</title>
<script>
// This script sets up drag-and-drop event listeners
document.addEventListener('DOMContentLoaded', (event) => {
// Prevent default drag behaviors
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
document.body.addEventListener(eventName, preventDefaults, false)
});
function preventDefaults(e) {
e.preventDefault();
e.stopPropagation();
}
// Highlight effect when dragging files over
['dragenter', 'dragover'].forEach(eventName => {
document.body.addEventListener(eventName, highlight, false)
});
['dragleave', 'drop'].forEach(eventName => {
document.body.addEventListener(eventName, unhighlight, false)
});
function highlight(e) {
document.body.style.backgroundColor = 'lightgrey';
}
function unhighlight(e) {
document.body.style.backgroundColor = '';
}
// Handle dropped files
document.body.addEventListener('drop', handleDrop, false);
function handleDrop(e) {
let dt = e.dataTransfer;
let files = dt.files;
// Process the files here
// Note: You won't be able to pass these files directly to the iframe due to CORS policies.
console.log(files);
}
});
</script>
</head>
<body>
<iframe src="https://7f935803acb1c81b86.gradio.live/" width="100%" height="100%" style="border:none;">
Your browser does not support iframes. Please click this <a href="https://7f935803acb1c81b86.gradio.live/">url</a>.
</iframe>
</body>
</html>
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gradio App Iframe</title>
</head>
<body>
<iframe src="https://7f935803acb1c81b86.gradio.live/" width="100%" height="100%" style="border:none;">
Your browser does not support iframes. Please click this <a href="https://7f935803acb1c81b86.gradio.live/">url</a>.
</iframe>
</body>
</html>
-->