Skip to content

Commit

Permalink
moved entity to path
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnemarieWittig committed Oct 10, 2023
1 parent 4df2b2f commit 9217e45
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions AutomationService/AutomationServiceBackend/app/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def handle_api_call(req: Request, file_to_identify: Optional[UploadFile] =
return response


@router.post("/ner",
@router.post("/ner/{entity}",
tags=["api"],
summary="Send a text to recognize. You can also add an entity type and language, but those have no impact.",
responses={
Expand All @@ -189,20 +189,19 @@ async def handle_api_call(req: Request, file_to_identify: Optional[UploadFile] =
"content": {
"application/json": {
"example": {
"entity": "address", # The entity type to recognize
"text": "I live at 123 Main Street in New York City.", # The text to recognize entities in
"language": "en" # The language of the text
}
}
}
}
})
def send_request(request_body: dict):
def send_request(entity, request_body: dict):
"""
Receive a JSON object containing the indentified entities and their labels. The form depends on your model.
The values entity and language are optional and will only be logged. They are not needed and have no effect on the result.
"""
logging.info("Received request: " + str(request_body))
logging.info(f"Received request for entity {entity}: " + str(request_body))

text = request_body['text']
result = handle_get_api_call(text, interface)
Expand Down

0 comments on commit 9217e45

Please sign in to comment.