moved model code to index.py