Update core.py

Add threaded option for flask server