コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 1 of about 1 for ModelName (0.001 sec.)
パスパラメータ 9414
パスパラメータ Pythonのformat文字列と同様のシンタックスで「パスパラメータ」や「パス変数」を宣言できます: Python 3.8+ from fastapi import FastAPI app = FastAPI () @app . get ( "/items/ {item_id} " ) async def read_item ( item_id ): return { ... 属性を作ります。すると、その値が使用可能な値となります: Python 3.8+ 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 ... 豆知識 "AlexNet"、"ResNet"そして"LeNet"は機械学習 モデル の名前です。 パスパラメータ の宣言 次に、作成したenumクラスである ModelName を使用した型アノテーションをもつ パスパラメータ を作成します: Python 3.8+ from enum import Enum from fastapi import FastAP ...
https://man.mtool.work/fastapi/0.115/tutorial/path-params/
PREV 1 NEXT