Skip to content

Commit b19de9d

Browse files
committed
Add ML request model
1 parent e75bfa7 commit b19de9d

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from datetime import datetime
2+
3+
from pydantic import BaseModel
4+
5+
6+
class Author(BaseModel):
7+
name: str
8+
accountHref: str
9+
10+
11+
class Comment(BaseModel):
12+
textContent: str
13+
publishedAt: datetime
14+
scrapedAt: datetime
15+
screenshotData: str
16+
nbLikes: int
17+
replies: list["Comment"]
18+
19+
20+
class Post(BaseModel):
21+
url: str
22+
publishedAt: datetime
23+
scrapedAt: datetime
24+
textContent: str
25+
postId: str
26+
socialNetwork: str
27+
author: Author
28+
comments: list[Comment]
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from balanceteshaters.routers.ml_model import Post
12
from fastapi import APIRouter
23

34
router = APIRouter()
45

56

67
@router.post("/post")
7-
def ml_post(publication: str):
8+
def ml_post(publication: Post):
89
results = []
910
print(results)
1011
return {"result": results}

0 commit comments

Comments
 (0)