Deploying Apps to Cornserve and Invoking Them
Once you've written your app, you can deploy it to Cornserve. The current deployment process is as follows:
- Save the app code in a single Python file (e.g.,
image_chat.py
). - Register & deploy the app to the Cornserve Gateway for validation and deployment:
export CORNSERVE_GATEWAY_URL=[...] cornserve register image_chat.py
- When validation succeeds, the Cornserve Gateway will deploy the app and all its subtasks on the Cornserve data plane, and the
cornserve
CLI invocation will return with the app's ID. - Finally, you can send requests to the Cornserve Gateway with your choice of HTTP client.
Notice that what comes within the
response = requests.post( f"{CORNSERVE_GATEWAY_URL}/app/invoke/{APP_ID}", json={ "request_data": { "image_url": "https://example.com/image.jpg", "prompt": "Describe the image.", } }, )
"request_data"
key is the JSON representation of yourRequest
class defined in our previous example.
Next Steps
To dive deeper into the architecture of Cornserve, check out our architecture guide.