TintinMeimei commited on
Commit
beb47a1
1 Parent(s): 938dc61

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +9 -1
static/script.js CHANGED
@@ -1,7 +1,15 @@
1
  const textGenForm = document.querySelector('.text-gen-form');
2
 
3
  const translateText = async (text) => {
4
- const inferResponse = await fetch(`infer_chatgpt?input=${text}`);
 
 
 
 
 
 
 
 
5
  const inferJson = await inferResponse.json();
6
 
7
  return inferJson.output;
 
1
  const textGenForm = document.querySelector('.text-gen-form');
2
 
3
  const translateText = async (text) => {
4
+ const settings = {
5
+ method: 'POST',
6
+ headers: {
7
+ Accept: 'application/json',
8
+ 'Content-Type': 'application/json',
9
+ },
10
+ body: JSON.stringify({'input': text})
11
+ };
12
+ const inferResponse = await fetch(`infer_chatgpt`, settings);
13
  const inferJson = await inferResponse.json();
14
 
15
  return inferJson.output;