Spaces:
Runtime error
Runtime error
Change CORS origin
Browse files
app.py
CHANGED
@@ -5,7 +5,8 @@ from flask_cors import CORS, cross_origin
|
|
5 |
import __main__
|
6 |
|
7 |
app = Flask(__name__)
|
8 |
-
CORS(app
|
|
|
9 |
# shortTokenizer = BartTokenizer.from_pretrained('sshleifer/distilbart-xsum-12-6')
|
10 |
# shortModel = BartForConditionalGeneration.from_pretrained('sshleifer/distilbart-xsum-12-6')
|
11 |
|
@@ -29,7 +30,7 @@ def recommend():
|
|
29 |
try:
|
30 |
short_output_summary, long_output_summary = summarize(input_text)
|
31 |
response = jsonify({'short': short_output_summary.strip(), 'long': long_output_summary.strip()})
|
32 |
-
response.headers.add('Access-Control-Allow-Origin', '
|
33 |
response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
|
34 |
response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS')
|
35 |
response.headers.add('Access-Control-Allow-Credentials', 'true')
|
|
|
5 |
import __main__
|
6 |
|
7 |
app = Flask(__name__)
|
8 |
+
cors = CORS(app)
|
9 |
+
app.config['CORS_HEADERS'] = 'Content-Type'
|
10 |
# shortTokenizer = BartTokenizer.from_pretrained('sshleifer/distilbart-xsum-12-6')
|
11 |
# shortModel = BartForConditionalGeneration.from_pretrained('sshleifer/distilbart-xsum-12-6')
|
12 |
|
|
|
30 |
try:
|
31 |
short_output_summary, long_output_summary = summarize(input_text)
|
32 |
response = jsonify({'short': short_output_summary.strip(), 'long': long_output_summary.strip()})
|
33 |
+
response.headers.add('Access-Control-Allow-Origin', 'http://0.0.0.0')
|
34 |
response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
|
35 |
response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS')
|
36 |
response.headers.add('Access-Control-Allow-Credentials', 'true')
|