Versatile solution for sharing apps through secure URLs
Project description
ModelPark
ModelPark provides a versatile platform to share and manage your ML models directly from your machine, offering a convenient Python API to manage these tasks programmatically, including controlling access and publishing applications.
This library provides a more Pythonic way of managing your applications with ModelPark compared to using the CLI directly.
See ModelPark website and platform for more details.
Features
- Share models directly from the Python API.
- Publish and manage applications using the ModelPark Python API.
- Configure access management according to your needs through Python methods.
Installation
To install ModelPark, you can use pip:
pip install modelpark
Configuration
Ensure Python and pip are installed on your machine. This API interfaces with the ModelPark CLI but manages interactions programmatically through Python.
Usage
Here's how you can use the ModelPark Python package:
Initialize and Login
from modelpark import ModelPark
mp = ModelPark() # downloads the modelpark CLI binary/ executable to your home folder as "~/modelpark'
mp.login(username="your_username", password="your_password")
mp.init()
clear cache while init (remove existing modelpark CLI binaries from system)
from modelpark import ModelPark
mp = ModelPark(clear_cache=True)
Register an Application
Register an app running on a certain port
mp.register(port=3000, name="my-app", access="public")
# access='private' if private (not visible/ accessible in modelpark dashboard)
Register a password protected app running on a certain port
mp.register_port(port=3000, name="my-app", access="public", password='123')
Register an app running on a certain port
mp.register_port(port=3000, name="my-app", access="public")
Register a streamlit app that is not run yet (this starts the app as well)
mp.run_with_streamlit_and_register(port=3000, name="my-app", file_path="~/my-app/streamlit-app.py", access="public", framework="streamlit")
# generic registration also works >>
# mp.register(port=3000, name="my-app", file_path="~/my-app/streamlit-app.py", access="public", framework="streamlit")
Register a streamlit app that is not run yet
mp.register(port=3000, name="my-app", file_path="~/my-app/streamlit-app.py", access="public", framework="streamlit")
Register a Fast API app while deploying
add register_port
within startup_event() function in FAST API app
@app.on_event("startup")
async def startup_event():
mp.register_port(port=5000, name="my-fast-api", access="public")
List Registered Applications
mp.ls()
# or mp.status()
Make an API Call to a Registered Application
from modelpark import APIManager
mp_api = APIManager()
user_credentials = {'username': 'your_username', 'password': 'your_password'}
app_name = 'my-app'
payload = {'key': 'value'} # Payload required by the application
# Make the API call
response = mp_api.make_api_call(app_name, user_credentials, payload)
print(response.json()) # Assuming the response is in JSON format
Stop and Logout
mp.stop()
mp.logout()
Kill an Application
mp.kill(name="my-app")
Kill all the registrations in this session
mp.kill(all=True)
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
Built Distribution
File details
Details for the file modelpark-0.1.12.tar.gz
.
File metadata
- Download URL: modelpark-0.1.12.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fbe066bfa0ec83222f481fdd7f2d1906d7014ea3f6906c05c415262f5fc7ab8 |
|
MD5 | 46a09985a5974438deefbbfa83fb5e7e |
|
BLAKE2b-256 | b8a56bb2a457cc2da288b7b3172727f6794d656b7dba72f988bbb477b3e15b3e |
File details
Details for the file modelpark-0.1.12-py3-none-any.whl
.
File metadata
- Download URL: modelpark-0.1.12-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8926f4cf10dcf60d7fe4d689b3ad63c6df13d59f730698d1bcaa6685e342c716 |
|
MD5 | 0f9ae66bc384e56b11e94b334d0dd8b3 |
|
BLAKE2b-256 | 29fe477f7ea3218b54c9709ed99489a2454e1cfa1bc05a9d162093c96b38987c |