File size: 498 Bytes
b2a5e86
ca2592c
 
 
8868222
ca2592c
 
 
 
 
 
 
 
 
 
 
 
 
 
8868222
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastapi import APIRouter
import logging

from commafixer.src.fixer import CommaFixer
from commafixer.routers.common import fix_commas_request_handler


logger = logging.Logger(__name__)
logging.basicConfig(level=logging.INFO)

router = APIRouter()

logger.info('Loading the main comma fixer model...')
router.model = CommaFixer()


@router.post('/')
async def fix_commas(data: dict):
    json_field_name = 's'
    return fix_commas_request_handler(json_field_name, data, logger, router.model)