Example | cortex

Example

# main.py

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()

class Data(BaseModel):
    msg: str

@app.post("/")
def handle_async(data: Data):
    return data

FROM python:3.8-slim

RUN pip install --no-cache-dir fastapi uvicorn
COPY main.py /

CMD uvicorn --host 0.0.0.0 --port 8080 main:app

Configure a Cortex deployment

Create a Cortex deployment

Wait for the API to be ready