Spaces:
Runtime error
Runtime error
- app.py +3 -3
- templates/index.html +1 -1
app.py
CHANGED
@@ -20,14 +20,14 @@ def recommend():
|
|
20 |
# Get form data
|
21 |
# request_data = request.args.get("input").get_json()
|
22 |
# input_text = request_data['input_text']
|
23 |
-
|
|
|
24 |
print(input_text)
|
25 |
|
26 |
# Call the function summarize to run the text summarization
|
27 |
try:
|
28 |
short_output_summary, long_output_summary = summarize(input_text)
|
29 |
-
response = jsonify(
|
30 |
-
response.headers.add("Access-Control-Allow-Origin", "*")
|
31 |
# Pass output summary to the output template
|
32 |
return response
|
33 |
|
|
|
20 |
# Get form data
|
21 |
# request_data = request.args.get("input").get_json()
|
22 |
# input_text = request_data['input_text']
|
23 |
+
request_data = request.args.get("input").get_json()
|
24 |
+
input_text = request_data['input_text']
|
25 |
print(input_text)
|
26 |
|
27 |
# Call the function summarize to run the text summarization
|
28 |
try:
|
29 |
short_output_summary, long_output_summary = summarize(input_text)
|
30 |
+
response = jsonify({'short': short_output_summary.strip(), 'long': long_output_summary.strip()})
|
|
|
31 |
# Pass output summary to the output template
|
32 |
return response
|
33 |
|
templates/index.html
CHANGED
@@ -198,7 +198,7 @@
|
|
198 |
// },
|
199 |
// referrerPolicy: 'no-referrer'
|
200 |
// };
|
201 |
-
const inferResponse = await fetch(`summarize?input=${jsonfile}`);
|
202 |
const inferJson = await inferResponse.json();
|
203 |
|
204 |
return inferJson;
|
|
|
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;
|