File size: 1,428 Bytes
fdcdc66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d2dc178
 
 
 
6197cb4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ed1c5c
 
 
 
6197cb4
6ed1c5c
6197cb4
 
559c2d6
 
6197cb4
 
44c32ca
6197cb4
5d94103
6197cb4
5d94103
 
 
0f7917e
 
559c2d6
 
0f7917e
 
 
fdcdc66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const textGenForm = document.querySelector('.text-gen-form');

const translateText = async (text) => {
    const inferResponse = await fetch(`infer_t5?input=${text}`);
    const inferJson = await inferResponse.json();

    return inferJson.output;
};

textGenForm.addEventListener('submit', async (event) => {
  event.preventDefault();

  const textGenInput = document.getElementById('text-gen-input');
  const textGenParagraph = document.querySelector('.text-gen-output');

  try {
    textGenParagraph.textContent = await translateText(textGenInput.value);
  } catch (err) {
    console.error(err);
  }
});














function submitImages(acceptedFiles) {
  const data = new FormData();

  for (const file of acceptedFiles){
    data.append('files[]', file, file.name);
  }

//  classifyResponse = fetch('classify', {
//     method: 'POST',
//    body: data
//  });

  return "aqa";
}

const inputImg = document.querySelector('.img-input');
const outputImg = document.querySelector('.img-output');
let imageArray = [];

inputImg.addEventListener("change", event =>{
  const files = event.target.files;
  res = "aaa"
  res = submitImages(files);
  console.log(res);

  outputImg.textContent = "Result is: " + res;
});

const classifyBtn = document.querySelector('.classify-btn');
const outputPar = document.querySelector('.test-output');

classifyBtn.addEventListener('onclick', () => {
  outputPar.textContent = "asa";
});