import json
import sys
import numpy
import coremltools
from tensorflow import keras

kerasmodel=""

def convert(json):
    kerasmodel=keras.models.model_from_json(json)
    print(kerasmodel.summary())
    

def main():
    jsonfile=sys.argv[1]
#    print("in main with args",jsonfile)
    f=open(jsonfile,'r')
#    print("1")
    data=json.load(f)
#    print("2")
    r=json.dumps(data)
#    print("3")
#    Parallel(n_jobs=2,prefer="threads")(delayed(convert(r)))
    convert(r)
#    print("4")
    #ctmodel=coremltools.convert(newmodel)
#    lastflash=jsonfile.rfind("/")
#    savepath=jsonfile[:lastflash]
#    print(savepath)
    

if __name__ == '__main__':
    main()
