Spaces:
Runtime error
Runtime error
Configure CORS setting for request packet
Browse files
app.py
CHANGED
@@ -1,8 +1,11 @@
|
|
1 |
from flask import Flask, render_template, request, jsonify
|
2 |
from modules.model import summarize
|
|
|
|
|
3 |
import __main__
|
4 |
|
5 |
app = Flask(__name__)
|
|
|
6 |
# shortTokenizer = BartTokenizer.from_pretrained('sshleifer/distilbart-xsum-12-6')
|
7 |
# shortModel = BartForConditionalGeneration.from_pretrained('sshleifer/distilbart-xsum-12-6')
|
8 |
|
@@ -26,6 +29,9 @@ def recommend():
|
|
26 |
short_output_summary, long_output_summary = summarize(input_text)
|
27 |
response = jsonify({'short': short_output_summary.strip(), 'long': long_output_summary.strip()})
|
28 |
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
|
|
|
|
|
29 |
# Pass output summary to the output template
|
30 |
return response
|
31 |
|
|
|
1 |
from flask import Flask, render_template, request, jsonify
|
2 |
from modules.model import summarize
|
3 |
+
from flask_cors import CORS, cross_origin
|
4 |
+
|
5 |
import __main__
|
6 |
|
7 |
app = Flask(__name__)
|
8 |
+
CORS(app, resources={r"/*": {"origins": "*"}})
|
9 |
# shortTokenizer = BartTokenizer.from_pretrained('sshleifer/distilbart-xsum-12-6')
|
10 |
# shortModel = BartForConditionalGeneration.from_pretrained('sshleifer/distilbart-xsum-12-6')
|
11 |
|
|
|
29 |
short_output_summary, long_output_summary = summarize(input_text)
|
30 |
response = jsonify({'short': short_output_summary.strip(), 'long': long_output_summary.strip()})
|
31 |
response.headers.add('Access-Control-Allow-Origin', '*')
|
32 |
+
response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
|
33 |
+
response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS')
|
34 |
+
response.headers.add('Access-Control-Allow-Credentials', 'true')
|
35 |
# Pass output summary to the output template
|
36 |
return response
|
37 |
|