How to run flask in chaquopy (java)

Hi, I want to run flask in chaquopy (java), but it’s showing error,
my python script is:

from flask import Flask
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def main():
    return("hi")
def startFlask():
    app.run(host="127.0.0.1", port=6501)

and from android studio, I use

PyObject obj = pyobj.callAttr("startFlask");

Then when it is called, it shows the following error :

Process: com.example.myapplication, PID: 8311
com.chaquo.python.PyException: TypeError: Cannot convert bytes object to java.lang.String

PLEASE HELP