mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-23 22:29:34 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
24 lines
546 B
Python
24 lines
546 B
Python
from enum import Enum
|
|
|
|
from fastapi import FastAPI
|
|
|
|
|
|
class ModelName(str, Enum):
|
|
alexnet = "alexnet"
|
|
resnet = "resnet"
|
|
lenet = "lenet"
|
|
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/models/{model_name}")
|
|
async def get_model(model_name: ModelName):
|
|
if model_name is ModelName.alexnet:
|
|
return {"model_name": model_name, "message": "Deep Learning FTW!"}
|
|
|
|
if model_name.value == "lenet":
|
|
return {"model_name": model_name, "message": "LeCNN all the images"}
|
|
|
|
return {"model_name": model_name, "message": "Have some residuals"}
|