Uthar commited on
Commit
b6673c1
·
verified ·
1 Parent(s): 7bb0d3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
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
- const img = document.querySelector('img'); // Select the target image element
153
- if (img) {
154
- monitorImageChange(img);
155
- } else {
156
- console.error('No image found to monitor.');
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
  """