Skip to content

Latest commit

 

History

History

1-asgi-fastapi-server

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Cerebrium ASGI Example (BETA)

This example demonstrates how to deploy a Cerebrium app using an ASGI server.

Warning: This functionality is in beta and may change in the future.

Required changes

[cerebrium.runtime.custom]
port = 5000
entrypoint = ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"]
healthcheck_endpoint = "/health"

Things to note

  • The port should be set to the port on which the ASGI server will run. Note that your requests to cerebrium will still be made to port 443.
  • The entrypoint should be set to the command that starts the ASGI server.
  • The code lives in the /cortex directory and this is also the entrypoint workdir.
  • The entrypoint should point to the ASGI server in the main.py file. For Uvicorn, the entrypoint should be uvicorn main:app ...

Making a request

curl --location 'https://api.cortex.cerebrium.ai/v4/<your-project-id>/1-asgi-fastapi-server/predict' \
--header 'Authorization: Bearer <your-rest-api-key>' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "your value here"
}'