The gravity-ai.com helper package
Reason this release was yanked:
Non-functional
Project description
Gravity-ai.com
This package includes helper scripts for interfacing your machine learning code with the Gravity-ai.com containerization code.
To install from pypi:
pip install gravityai
To install from source:
python3 setup.py install
Example Implementation Code
from gravityai import gravityai as grav
# the following function is a callback (defined by you), that may be
# async or synchronous and that may be called multiple times, to
# transform input data against an algorithm or model (or whatever you want)
# If an error is experienced, return an error string message, or throw an exception.
def process_data(dataPath, outPath):
# TODO:
# Read data in from dataPath
# Transform Data via model
# Write data out to outPath
# Return None if everything went ok.
# return an error string if there was a problem.
# TODO Initialize models, etc. before calling wait_for_requests.
grav.wait_for_requests(process_data)
Running Multiple Files
This section explains how to use multiple files. You will require a csv with the column "uri", where each row is a uri where an input file is stored:
from gravityai import gravityai as grav
'''
In continuation of the section above, define a callback function:
def process_data(dataPath, outPath):
#TODO:
# 1) Read data in from dataPath (csv containing column "uri")
# NOTE: dataPath will likely end with a non-standard file extension (like .dat), so make sure your code can handle
# a filename with an extension different than expected. You may need to rename the input file to .zip. .csv, etc for it to load
# properly in your code.
# 2) Define a custom handling function to process the input file, with whatever arguments are necessary:
def handle_fnc(filePath, row, **kwargs):
# read file from filePath, read whatever data is necessary from the Pandas df row.
# perform processing
# return pandas df after processing
grav.handle_csvs_with_uris(dataPath, outPath, handle_fnc, **kwargs)
'''
grav.wait_for_requests(process_data)
Building a new Version
To build a new version for pypi (only we do that):
python3 -m pip install --user --upgrade setuptools wheel
python3 -m pip install --user --upgrade twine
python3 setup.py sdist bdist_wheel
python3 -m twine upload --repository pypi dist/*
Use the saved credentials, and remember the username is __token__
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gravityai-0.1.4.post1.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for gravityai-0.1.4.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3925317aa5ec45e925ba4c30fed4bf7d65769d7b47f816070de43ce8af6aea06 |
|
MD5 | 6d609c4262cdf35d34e7bdd1c2df69ab |
|
BLAKE2b-256 | fcb5f413f2452c22a50d62e63cdf404370bfdd6ed8fdcc3077cf81406e269397 |