qianmuuq commited on
Commit
2538a63
1 Parent(s): b9e050e

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +11 -11
static/script.js CHANGED
@@ -4,7 +4,7 @@ const translateText = async (text) => {
4
  const inferResponse = await fetch(`infer_t5?input=${text}`);
5
  const inferJson = await inferResponse.json();
6
 
7
- return inferJson.output,inferJson.size_str,inferJson.size_4,inferJson.cancer,inferJson.transfer,inferJson.ly_transfer;
8
  };
9
 
10
  textGenForm.addEventListener('submit', async (event) => {
@@ -12,18 +12,18 @@ textGenForm.addEventListener('submit', async (event) => {
12
 
13
  const textGenInput = document.getElementById('text-gen-input');
14
  const textGenParagraph = document.querySelector('.text-gen-output');
15
- // const textGenParagraph_2 = document.querySelector('.text-gen-output_2');
16
- // const textGenParagraph_3 = document.querySelector('.text-gen-output_3');
17
- // const textGenParagraph_4 = document.querySelector('.text-gen-output_4');
18
- // const textGenParagraph_5 = document.querySelector('.text-gen-output_5');
19
 
20
  try {
21
- var text_out,size_str,size_4,cancer,transfer,ly_transfer = await translateText(textGenInput.value);
22
- textGenParagraph.textContent = size_str;
23
- // textGenParagraph_2.textContent = size_4;
24
- // textGenParagraph_3.textContent = cancer;
25
- // textGenParagraph_4.textContent = transfer;
26
- // textGenParagraph_5.textContent = ly_transfer;
27
  } catch (err) {
28
  console.error(err);
29
  }
 
4
  const inferResponse = await fetch(`infer_t5?input=${text}`);
5
  const inferJson = await inferResponse.json();
6
 
7
+ return inferJson;
8
  };
9
 
10
  textGenForm.addEventListener('submit', async (event) => {
 
12
 
13
  const textGenInput = document.getElementById('text-gen-input');
14
  const textGenParagraph = document.querySelector('.text-gen-output');
15
+ const textGenParagraph_2 = document.querySelector('.text-gen-output_2');
16
+ const textGenParagraph_3 = document.querySelector('.text-gen-output_3');
17
+ const textGenParagraph_4 = document.querySelector('.text-gen-output_4');
18
+ const textGenParagraph_5 = document.querySelector('.text-gen-output_5');
19
 
20
  try {
21
+ var text_out = await translateText(textGenInput.value);
22
+ textGenParagraph.textContent = text_out.size_str;
23
+ textGenParagraph_2.textContent = text_out.size_4;
24
+ textGenParagraph_3.textContent = text_out.cancer;
25
+ textGenParagraph_4.textContent = text_out.transfer;
26
+ textGenParagraph_5.textContent = text_out.ly_transfer;
27
  } catch (err) {
28
  console.error(err);
29
  }