big refactory to upload model.

Signed-off-by: Daogang Tang <daogangtang@gmail.com>