health_route

This commit is contained in:
ahmed531998 2023-04-07 17:35:51 +02:00
parent 5550207277
commit dff4d7c762
1 changed files with 5 additions and 1 deletions

View File

@ -24,7 +24,7 @@ from sentence_transformers import SentenceTransformer
app = Flask(__name__)
url = os.getenv("FRONTEND_URL_WITH_PORT")
cors = CORS(app, resources={r"/predict": {"origins": *}, r"/feedback": {"origins": *}})
cors = CORS(app, resources={r"/predict": {"origins": url}, r"/feedback": {"origins": url}, r"/health": {"origins": *}})
conn = psycopg2.connect(
host="janet-pg",
@ -55,6 +55,10 @@ def user_interest_decay():
time.sleep(180)
user.decay_interests()
@app.route("/health", methods=['GET'])
def check_health():
return "Success", 200
@app.route("/predict", methods=['POST'])
def predict():
text = request.get_json().get("message")