Object Storage
Object storage provides a simple way to transmit small files between deployments, and between the deployment and the client.
Types of Object Storage
1. Public Object Storage
Public Object Storage is an object storage service that is accessible to all requests from the internet. It is suitable for storing public data such as images, videos, and other files that are meant to be accessible to the public.
2. Private Object Storage
Private Object Storage is an object storage service that is accessible only with an authorized request. It is suitable for storing private data that should not be accessible to the public. And it can also provides a temporary public URL with 900 seconds expiration time.
Manage files
Upload files
1. WebUI
- Go to the Storage tab, and click on Object Storage.
- Click on the type of object storage you want to upload to.
- Click on Upload File on the top right corner.
2. Python SDK
from leptonai.objectstore import ObjectStore
# Upload file to private object storage
bucket = ObjectStore('private')
bucket.put('file_name_in_bucket','path/to/file')
Get files
1. WebUI
- Go to the Storage tab, and click on Object Storage.
- Click on the type of object storage you want to get files from.
- Click the dot icon on the right side of the file name, and click it to see the download option.
2. Python SDK
from leptonai.objectstore import ObjectStore
import shutil
# Specify the type of object storage
bucket = ObjectStore('private')
# Get temporary file and copy it to local
x = bucket.get('path/to/file')
shutil.copy(x.name,'path/to/save/file')
Delete files
1. WebUI
- Go to the Storage tab, and click on Object Storage.
- Click on the type of object storage you want to delete files from.
- Click the dot icon on the right side of the file name, and click it to see the delete option.
2. Python SDK
from leptonai.objectstore import ObjectStore
# Specify the type of object storage
bucket = ObjectStore('private')
# Delete file
bucket.delete('path/to/file')