Spaces:
Paused
Paused
Commit
•
c892caa
1
Parent(s):
6ca460a
Add validation to the 'vote' field in the Vote model
Browse files
main.py
CHANGED
@@ -10,7 +10,7 @@ from fastapi import BackgroundTasks, FastAPI, Header
|
|
10 |
from fastapi.middleware.cors import CORSMiddleware
|
11 |
from huggingface_hub import CommitScheduler, HfApi, whoami
|
12 |
from huggingface_hub.utils._errors import HTTPError
|
13 |
-
from pydantic import BaseModel
|
14 |
from starlette.responses import RedirectResponse
|
15 |
|
16 |
load_dotenv()
|
@@ -69,7 +69,7 @@ def root():
|
|
69 |
class Vote(BaseModel):
|
70 |
dataset: str
|
71 |
description: str
|
72 |
-
vote: int
|
73 |
userID: str
|
74 |
|
75 |
|
|
|
10 |
from fastapi.middleware.cors import CORSMiddleware
|
11 |
from huggingface_hub import CommitScheduler, HfApi, whoami
|
12 |
from huggingface_hub.utils._errors import HTTPError
|
13 |
+
from pydantic import BaseModel, Field
|
14 |
from starlette.responses import RedirectResponse
|
15 |
|
16 |
load_dotenv()
|
|
|
69 |
class Vote(BaseModel):
|
70 |
dataset: str
|
71 |
description: str
|
72 |
+
vote: int = Field(..., ge=0, le=1)
|
73 |
userID: str
|
74 |
|
75 |
|