Update app.py
Browse files
app.py
CHANGED
|
@@ -116,6 +116,7 @@ def add_gallery(image, model_str, gallery):
|
|
| 116 |
js="""
|
| 117 |
<script>
|
| 118 |
|
|
|
|
| 119 |
downloadImage = (url, filename) => {
|
| 120 |
const a = document.createElement('a');
|
| 121 |
a.href = url;
|
|
@@ -149,12 +150,16 @@ const monitorImageChange = (imageElement) => {
|
|
| 149 |
console.log('Now monitoring image changes for:', imageElement);
|
| 150 |
};
|
| 151 |
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
</script>
|
| 160 |
"""
|
|
|
|
| 116 |
js="""
|
| 117 |
<script>
|
| 118 |
|
| 119 |
+
// Function to download an image
|
| 120 |
downloadImage = (url, filename) => {
|
| 121 |
const a = document.createElement('a');
|
| 122 |
a.href = url;
|
|
|
|
| 150 |
console.log('Now monitoring image changes for:', imageElement);
|
| 151 |
};
|
| 152 |
|
| 153 |
+
// Start monitoring after page load
|
| 154 |
+
window.addEventListener('load', () => {
|
| 155 |
+
const img = document.querySelector('img'); // Select the target image element
|
| 156 |
+
if (img) {
|
| 157 |
+
monitorImageChange(img);
|
| 158 |
+
} else {
|
| 159 |
+
console.error('No image found to monitor.');
|
| 160 |
+
}
|
| 161 |
+
});
|
| 162 |
+
|
| 163 |
|
| 164 |
</script>
|
| 165 |
"""
|