Ashrafb commited on
Commit
2861183
·
verified ·
1 Parent(s): bc1fd68

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +5 -9
static/index.html CHANGED
@@ -333,9 +333,7 @@ input[type="number"]#best_max_flavors:focus {
333
 
334
  <img id="sourceImage">
335
  </div><br>
336
- <label for="question" style="display: none;">Enter your question:</label>
337
- <input type="text" id="Question" style="display: none;" value="describe" required>
338
- <br>
339
  <button type="button" onclick="generateDescription()">Generate Description</button>
340
  </form>
341
  <div id="results">
@@ -352,8 +350,8 @@ input[type="number"]#best_max_flavors:focus {
352
  const uploadButton = document.querySelector('button');
353
 
354
  // Check if file size is larger than 500 KB
355
- if (file.size > 4000 * 1024) {
356
- sourceImageContainer.innerHTML = `<p style="color: white;">Please upload an image smaller than 4000 KB.</p>`;
357
  uploadButton.disabled = true; // Disable the button
358
  return;
359
  }
@@ -370,9 +368,7 @@ input[type="number"]#best_max_flavors:focus {
370
  async function generateDescription() {
371
  var formData = new FormData();
372
  var fileInput = document.querySelector('input[type="file"]');
373
- const QuestionInput = document.getElementById('Question');
374
- formData.append("image", fileInput.files[0]);
375
- formData.append("Question", QuestionInput.value);
376
  // Check if the file input is empty
377
  if (!fileInput.files[0]) {
378
  document.getElementById('resultContainer').innerHTML = `<p style="color: white ;">Please upload an image.</p>`;
@@ -388,7 +384,7 @@ input[type="number"]#best_max_flavors:focus {
388
  estimatedTime.style.display = 'block';
389
 
390
  try {
391
- const response = await fetch('/upload/', {
392
  method: 'POST',
393
  body: formData
394
  });
 
333
 
334
  <img id="sourceImage">
335
  </div><br>
336
+
 
 
337
  <button type="button" onclick="generateDescription()">Generate Description</button>
338
  </form>
339
  <div id="results">
 
350
  const uploadButton = document.querySelector('button');
351
 
352
  // Check if file size is larger than 500 KB
353
+ if (file.size > 1000 * 1024) {
354
+ sourceImageContainer.innerHTML = `<p style="color: white;">Please upload an image smaller than 1000 KB.</p>`;
355
  uploadButton.disabled = true; // Disable the button
356
  return;
357
  }
 
368
  async function generateDescription() {
369
  var formData = new FormData();
370
  var fileInput = document.querySelector('input[type="file"]');
371
+ formData.append("file", fileInput.files[0]);
 
 
372
  // Check if the file input is empty
373
  if (!fileInput.files[0]) {
374
  document.getElementById('resultContainer').innerHTML = `<p style="color: white ;">Please upload an image.</p>`;
 
384
  estimatedTime.style.display = 'block';
385
 
386
  try {
387
+ const response = await fetch('/uploadfile/', {
388
  method: 'POST',
389
  body: formData
390
  });