I have a python app locally that I am trying to interact with on my webpage with flask. How do I do this?

Solution
@app.route("/therapist", methods=['GET', 'POST'])
def therapist():
    def therapist_chat():
        userText = request.args.get('msg')
        return chat(userText)
    return render_template("therapist.html")
@app.route("/therapist", methods=['GET'])
def therapist():
    userText = request.args.get('msg')
    return chat(userText)