Код: Выделить всё
class Text(BaseModel):
id: str
text: str = None
class TextsRequest(BaseModel):
data: list[Text]
n_processes: Union[int, None]
Код: Выделить всё
{"data": ["id": "1", "text": "The text 1"], "n_processes": 8}
Код: Выделить всё
{"data": ["id": "1", "text": "The text 1"]}.
Код: Выделить всё
{'data': [{'id': '1', 'text': 'The text 1'}], 'n_processes': None}
Код: Выделить всё
app = FastAPI()
@app.post("/make_post/", response_model_exclude_none=True)
async def create_graph(request: TextsRequest):
input_data = jsonable_encoder(request)
Подробнее здесь: https://stackoverflow.com/questions/731 ... ng-fastapi
Мобильная версия