Exemple #1
0
def get_model(bucket, team_id, user_id):
    key = f"models/{team_id}/{user_id}.json"
    print(f'downloading model {key}')

    model_json = BytesIO()
    bucket.download_fileobj(key, model_json)
    model = str(model_json.getbuffer(), 'utf-8')
    return NewlineText.from_chain(model)
Exemple #2
0
def get_compressed_model(bucket, team_id, user_id):
    key = f"models/{team_id}/{user_id}.gz"
    print(f'downloading model {key}')

    model_gz = BytesIO()
    bucket.download_fileobj(key, model_gz)
    model = str(zlib.decompress(model_gz.getbuffer()), 'utf-8')
    return NewlineText.from_chain(model)