datien228 commited on
Commit
7f67da7
1 Parent(s): 46dd2fb
Files changed (2) hide show
  1. app.py +1 -2
  2. templates/index.html +7 -11
app.py CHANGED
@@ -20,8 +20,7 @@ def recommend():
20
  # Get form data
21
  # request_data = request.args.get("input").get_json()
22
  # input_text = request_data['input_text']
23
- request_data = request.json.get("input")
24
- input_text = request_data['input_text']
25
  print(input_text)
26
 
27
  # Call the function summarize to run the text summarization
 
20
  # Get form data
21
  # request_data = request.args.get("input").get_json()
22
  # input_text = request_data['input_text']
23
+ input_text = request.get_json()['input_text']
 
24
  print(input_text)
25
 
26
  # Call the function summarize to run the text summarization
templates/index.html CHANGED
@@ -188,17 +188,13 @@
188
  // ======= COMMUNICATE WITH FLSAK BACK END TO RUN ML TASK =======
189
 
190
  const translateText = async (jsonfile) => {
191
- // const fetchSettings = {
192
- // method: 'POST',
193
- // mode: 'cors',
194
- // credentials: 'same-origin',
195
- // body: JSON.stringify({"input_text": jsonfile}),
196
- // headers: {
197
- // "Content-Type": "application/json"
198
- // },
199
- // referrerPolicy: 'no-referrer'
200
- // };
201
- const inferResponse = await fetch(`summarize?input=${JSON.stringify({"input_text": jsonfile})}`);
202
  const inferJson = await inferResponse.json();
203
 
204
  return inferJson;
 
188
  // ======= COMMUNICATE WITH FLSAK BACK END TO RUN ML TASK =======
189
 
190
  const translateText = async (jsonfile) => {
191
+ const fetchSettings = {
192
+ body: JSON.stringify({"input_text": jsonfile}),
193
+ headers: {
194
+ "Content-Type": "application/json"
195
+ },
196
+ };
197
+ const inferResponse = await fetch(`summarize`, fetchSettings);
 
 
 
 
198
  const inferJson = await inferResponse.json();
199
 
200
  return inferJson;