fix:service some bug
Some checks failed
Deploy to Staging / deploy (push) Has been cancelled
Lint Backend / lint-backend (push) Has been cancelled
Playwright Tests / changes (push) Has been cancelled
Test Backend / test-backend (push) Has been cancelled
Test Docker Compose / test-docker-compose (push) Has been cancelled
Playwright Tests / test-playwright (1, 4) (push) Has been cancelled
Playwright Tests / test-playwright (2, 4) (push) Has been cancelled
Playwright Tests / test-playwright (3, 4) (push) Has been cancelled
Playwright Tests / test-playwright (4, 4) (push) Has been cancelled
Playwright Tests / merge-playwright-reports (push) Has been cancelled
Playwright Tests / alls-green-playwright (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled
Some checks failed
Deploy to Staging / deploy (push) Has been cancelled
Lint Backend / lint-backend (push) Has been cancelled
Playwright Tests / changes (push) Has been cancelled
Test Backend / test-backend (push) Has been cancelled
Test Docker Compose / test-docker-compose (push) Has been cancelled
Playwright Tests / test-playwright (1, 4) (push) Has been cancelled
Playwright Tests / test-playwright (2, 4) (push) Has been cancelled
Playwright Tests / test-playwright (3, 4) (push) Has been cancelled
Playwright Tests / test-playwright (4, 4) (push) Has been cancelled
Playwright Tests / merge-playwright-reports (push) Has been cancelled
Playwright Tests / alls-green-playwright (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled
This commit is contained in:
@@ -2,6 +2,7 @@ from fastapi import APIRouter, Depends
|
|||||||
from pydantic.networks import EmailStr
|
from pydantic.networks import EmailStr
|
||||||
import httpx
|
import httpx
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
import re
|
||||||
|
|
||||||
from app.api.deps import get_current_active_superuser
|
from app.api.deps import get_current_active_superuser
|
||||||
from app.models import Message
|
from app.models import Message
|
||||||
@@ -37,10 +38,15 @@ class ClassifyRequest(BaseModel):
|
|||||||
|
|
||||||
@router.post("/bentoml_classifiy")
|
@router.post("/bentoml_classifiy")
|
||||||
async def bentoml_classifiy(data: ClassifyRequest):
|
async def bentoml_classifiy(data: ClassifyRequest):
|
||||||
|
text = data.text
|
||||||
|
cleaned_text = text.strip().replace("\n", "")
|
||||||
|
cleaned_text = re.sub(r'[\x00-\x1F]', '', cleaned_text)
|
||||||
|
|
||||||
|
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
"http://120.76.41.122:3000/classify",
|
"http://120.76.41.122:3000/classify",
|
||||||
json={"text": f"{data.text}"}
|
json={"text": f"{cleaned_text}"}
|
||||||
)
|
)
|
||||||
result = response.json()
|
result = response.json()
|
||||||
return fast_json_response(data=result)
|
return fast_json_response(data=result)
|
||||||
|
|||||||
Reference in New Issue
Block a user