health_route
This commit is contained in:
parent
5550207277
commit
dff4d7c762
6
main.py
6
main.py
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue