shukdevdatta123 commited on
Commit
e09b89e
·
verified ·
1 Parent(s): ea9a986

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -358,23 +358,22 @@ html_footer = """
358
  if (submitBtn) {
359
  submitBtn.addEventListener('click', function() {
360
  showLoading();
361
- setTimeout(function() {
362
- const output = document.querySelector('.recipe-output');
 
 
363
  if (output && output.textContent.trim().length > 0) {
364
  hideLoading();
365
- } else {
366
- const checkInterval = setInterval(function() {
367
- if (output && output.textContent.trim().length > 0) {
368
- hideLoading();
369
- clearInterval(checkInterval);
370
- }
371
- }, 1000);
372
- setTimeout(function() {
373
- hideLoading();
374
- clearInterval(checkInterval);
375
- }, 30000);
376
  }
377
- }, 3000);
 
 
 
 
 
 
378
  });
379
  }
380
  });
 
358
  if (submitBtn) {
359
  submitBtn.addEventListener('click', function() {
360
  showLoading();
361
+ const output = document.querySelector('.recipe-output');
362
+
363
+ // Check every second for output content
364
+ const checkInterval = setInterval(function() {
365
  if (output && output.textContent.trim().length > 0) {
366
  hideLoading();
367
+ clearInterval(checkInterval);
368
+ clearTimeout(forceHideTimeout);
 
 
 
 
 
 
 
 
 
369
  }
370
+ }, 60000);
371
+
372
+ // Force hide after 120 seconds
373
+ const forceHideTimeout = setTimeout(function() {
374
+ hideLoading();
375
+ clearInterval(checkInterval);
376
+ }, 120000); // 120000 milliseconds = 120 seconds
377
  });
378
  }
379
  });