Код: Выделить всё
import flask
from flask import Flask, render_template, request
import pickle
import numpy as np
from flask_ngrok import run_with_ngrok
import warnings
warnings.filterwarnings('ignore')
app = Flask(__name__)
run_with_ngrok(app)
model = pickle.load(open('model_file.p', 'rb'))
@app.route('/', methods=['GET'])
def home():
return render_template('index.html')
@app.route('/', methods=['GET', "POST"])
def predict():
input_values = [float(x) for x in request.form.values()]
inp_features = [input_values]
prediction = model.predict(inp_features)
if prediction > 0.5:
return render_template('index.html', prediction_text='Predicting a Recession in the US in the near future.')
else:
return render_template('index.html', prediction_text='Predicting no Recession in the US in the near future.')
app.run()

Хотя я продолжаю нажимать «Посетить сайт», это никогда не приводит меня к site и просто перезагружает ту же страницу с предупреждением. Перепробовал все браузеры, включая Edge. Я даже разблокировал сторонние файлы cookie. Все еще не могу избежать этого.
Подробнее здесь: https://stackoverflow.com/questions/732 ... rok-io-web