Ashrafb commited on
Commit
f64c71d
·
verified ·
1 Parent(s): adc138f

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +6 -10
static/index.html CHANGED
@@ -403,17 +403,12 @@ input[type="number"]#best_max_flavors:focus {
403
  const resultContainer = document.getElementById('resultContainer');
404
  const data = await response.text(); // Get response as text
405
 
406
- // Split the data into an array of words
407
- const wordsArray = data.split(' ');
 
408
 
409
- // Filter out empty strings and duplicates
410
- const uniqueWords = wordsArray.filter((word, index) => word !== '' && wordsArray.indexOf(word) === index);
411
-
412
- // Join the unique words to form a complete sentence
413
- const completeSentence = uniqueWords.join(' ');
414
-
415
- // Display the complete sentence in the result container
416
- resultContainer.innerHTML = `<p style="color: white;">The image features ${completeSentence}.</p>`;
417
  } else {
418
  document.getElementById('resultContainer').innerHTML = `<p style="color: white;">Oops! Something went wrong. Please try again later.</p>`;
419
  }
@@ -423,6 +418,7 @@ input[type="number"]#best_max_flavors:focus {
423
  }
424
  }
425
 
 
426
  function copyTextToClipboard() {
427
  const resultContainer = document.getElementById('resultContainer');
428
  const textToCopy = resultContainer.innerText;
 
403
  const resultContainer = document.getElementById('resultContainer');
404
  const data = await response.text(); // Get response as text
405
 
406
+ // Extract the last sentence from the response string
407
+ const lastCommaIndex = data.lastIndexOf(',');
408
+ const lastSentence = data.substring(lastCommaIndex + 1).trim();
409
 
410
+ // Display the last sentence in the result container
411
+ resultContainer.innerHTML = `<p style="color: white;">${lastSentence}</p>`;
 
 
 
 
 
 
412
  } else {
413
  document.getElementById('resultContainer').innerHTML = `<p style="color: white;">Oops! Something went wrong. Please try again later.</p>`;
414
  }
 
418
  }
419
  }
420
 
421
+
422
  function copyTextToClipboard() {
423
  const resultContainer = document.getElementById('resultContainer');
424
  const textToCopy = resultContainer.innerText;