Spaces:
Sleeping
Sleeping
anpha@DESKTOP-IT4F327 commited on
Commit ·
b2fdfec
1
Parent(s): 197edbc
20250315
Browse files- backend/api/routes/admin.py +2 -2
- backend/api/routes/auth.py +4 -4
- backend/api/routes/extension.py +5 -5
- backend/api/routes/prediction.py +5 -5
- backend/api/routes/toxic_detection.py +5 -5
- backend/config/security.py +1 -1
- backend/db/models/comment.py +1 -1
- backend/db/models/log.py +1 -1
- backend/db/models/user.py +1 -1
- backend/services/user_service.py +2 -2
backend/api/routes/admin.py
CHANGED
|
@@ -3,8 +3,8 @@ from fastapi import APIRouter, Depends, HTTPException, status
|
|
| 3 |
from sqlalchemy.orm import Session
|
| 4 |
from typing import List
|
| 5 |
from backend.db.models import get_db, User, Role, Log, Comment
|
| 6 |
-
from api.models.prediction import UserResponse, LogResponse, CommentResponse
|
| 7 |
-
from api.routes.auth import get_admin_user
|
| 8 |
|
| 9 |
router = APIRouter()
|
| 10 |
|
|
|
|
| 3 |
from sqlalchemy.orm import Session
|
| 4 |
from typing import List
|
| 5 |
from backend.db.models import get_db, User, Role, Log, Comment
|
| 6 |
+
from backend.api.models.prediction import UserResponse, LogResponse, CommentResponse
|
| 7 |
+
from backend.api.routes.auth import get_admin_user
|
| 8 |
|
| 9 |
router = APIRouter()
|
| 10 |
|
backend/api/routes/auth.py
CHANGED
|
@@ -5,10 +5,10 @@ from sqlalchemy.orm import Session
|
|
| 5 |
from typing import List
|
| 6 |
from datetime import datetime, timedelta
|
| 7 |
from jose import JWTError, jwt
|
| 8 |
-
from db.models import get_db, User, Role
|
| 9 |
-
from api.models.prediction import UserCreate, UserResponse, TokenResponse
|
| 10 |
-
from core.security import get_password_hash, verify_password
|
| 11 |
-
from config.settings import settings
|
| 12 |
|
| 13 |
router = APIRouter()
|
| 14 |
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/auth/token")
|
|
|
|
| 5 |
from typing import List
|
| 6 |
from datetime import datetime, timedelta
|
| 7 |
from jose import JWTError, jwt
|
| 8 |
+
from backend.db.models import get_db, User, Role
|
| 9 |
+
from backend.api.models.prediction import UserCreate, UserResponse, TokenResponse
|
| 10 |
+
from backend.core.security import get_password_hash, verify_password
|
| 11 |
+
from backend.config.settings import settings
|
| 12 |
|
| 13 |
router = APIRouter()
|
| 14 |
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/auth/token")
|
backend/api/routes/extension.py
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks
|
| 3 |
from sqlalchemy.orm import Session
|
| 4 |
from typing import List, Dict, Any
|
| 5 |
-
from db.models import get_db, Comment
|
| 6 |
-
from api.models.prediction import PredictionRequest, PredictionResponse
|
| 7 |
-
from services.ml_model import MLModel
|
| 8 |
-
from config.security import verify_api_key
|
| 9 |
-
from utils.vector_utils import extract_features
|
| 10 |
|
| 11 |
router = APIRouter()
|
| 12 |
ml_model = MLModel()
|
|
|
|
| 2 |
from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks
|
| 3 |
from sqlalchemy.orm import Session
|
| 4 |
from typing import List, Dict, Any
|
| 5 |
+
from backend.db.models import get_db, Comment
|
| 6 |
+
from backend.api.models.prediction import PredictionRequest, PredictionResponse
|
| 7 |
+
from backend.services.ml_model import MLModel
|
| 8 |
+
from backend.config.security import verify_api_key
|
| 9 |
+
from backend.utils.vector_utils import extract_features
|
| 10 |
|
| 11 |
router = APIRouter()
|
| 12 |
ml_model = MLModel()
|
backend/api/routes/prediction.py
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks
|
| 3 |
from sqlalchemy.orm import Session
|
| 4 |
from typing import List
|
| 5 |
-
from db.models import get_db, Comment, User
|
| 6 |
-
from api.models.prediction import PredictionRequest, PredictionResponse, BatchPredictionRequest, BatchPredictionResponse
|
| 7 |
-
from services.ml_model import MLModel
|
| 8 |
-
from api.routes.auth import get_current_user
|
| 9 |
-
from utils.vector_utils import extract_features
|
| 10 |
import numpy as np
|
| 11 |
|
| 12 |
router = APIRouter()
|
|
|
|
| 2 |
from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks
|
| 3 |
from sqlalchemy.orm import Session
|
| 4 |
from typing import List
|
| 5 |
+
from backend.db.models import get_db, Comment, User
|
| 6 |
+
from backend.api.models.prediction import PredictionRequest, PredictionResponse, BatchPredictionRequest, BatchPredictionResponse
|
| 7 |
+
from backend.services.ml_model import MLModel
|
| 8 |
+
from backend.api.routes.auth import get_current_user
|
| 9 |
+
from backend.utils.vector_utils import extract_features
|
| 10 |
import numpy as np
|
| 11 |
|
| 12 |
router = APIRouter()
|
backend/api/routes/toxic_detection.py
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
from fastapi import APIRouter, Depends, HTTPException
|
| 3 |
from sqlalchemy.orm import Session
|
| 4 |
from typing import List, Optional
|
| 5 |
-
from db.models import get_db, Comment
|
| 6 |
-
from api.models.prediction import CommentResponse
|
| 7 |
-
from api.routes.auth import get_current_user
|
| 8 |
-
from db.models import User
|
| 9 |
-
from utils.vector_utils import compute_similarity, extract_features
|
| 10 |
import numpy as np
|
| 11 |
|
| 12 |
router = APIRouter()
|
|
|
|
| 2 |
from fastapi import APIRouter, Depends, HTTPException
|
| 3 |
from sqlalchemy.orm import Session
|
| 4 |
from typing import List, Optional
|
| 5 |
+
from backend.db.models import get_db, Comment
|
| 6 |
+
from backend.api.models.prediction import CommentResponse
|
| 7 |
+
from backend.api.routes.auth import get_current_user
|
| 8 |
+
from backend.db.models import User
|
| 9 |
+
from backend.utils.vector_utils import compute_similarity, extract_features
|
| 10 |
import numpy as np
|
| 11 |
|
| 12 |
router = APIRouter()
|
backend/config/security.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
from passlib.context import CryptContext
|
| 3 |
from fastapi import Depends, HTTPException, status
|
| 4 |
from fastapi.security import APIKeyHeader
|
| 5 |
-
from config.settings import settings
|
| 6 |
|
| 7 |
# Password hashing
|
| 8 |
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
|
|
|
| 2 |
from passlib.context import CryptContext
|
| 3 |
from fastapi import Depends, HTTPException, status
|
| 4 |
from fastapi.security import APIKeyHeader
|
| 5 |
+
from backend.config.settings import settings
|
| 6 |
|
| 7 |
# Password hashing
|
| 8 |
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
backend/db/models/comment.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
from sqlalchemy import Column, Integer, String, Float, DateTime, ForeignKey, Text, JSON
|
| 3 |
from sqlalchemy.orm import relationship
|
| 4 |
from sqlalchemy.sql import func
|
| 5 |
-
from .base import Base
|
| 6 |
import numpy as np
|
| 7 |
import json
|
| 8 |
|
|
|
|
| 2 |
from sqlalchemy import Column, Integer, String, Float, DateTime, ForeignKey, Text, JSON
|
| 3 |
from sqlalchemy.orm import relationship
|
| 4 |
from sqlalchemy.sql import func
|
| 5 |
+
from backend.db.models.base import Base
|
| 6 |
import numpy as np
|
| 7 |
import json
|
| 8 |
|
backend/db/models/log.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Text, JSON
|
| 3 |
from sqlalchemy.orm import relationship
|
| 4 |
from sqlalchemy.sql import func
|
| 5 |
-
from .base import Base
|
| 6 |
|
| 7 |
class Log(Base):
|
| 8 |
__tablename__ = "logs"
|
|
|
|
| 2 |
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Text, JSON
|
| 3 |
from sqlalchemy.orm import relationship
|
| 4 |
from sqlalchemy.sql import func
|
| 5 |
+
from backend.db.models.base import Base
|
| 6 |
|
| 7 |
class Log(Base):
|
| 8 |
__tablename__ = "logs"
|
backend/db/models/user.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DateTime
|
| 3 |
from sqlalchemy.orm import relationship
|
| 4 |
from sqlalchemy.sql import func
|
| 5 |
-
from .base import Base
|
| 6 |
|
| 7 |
class User(Base):
|
| 8 |
__tablename__ = "users"
|
|
|
|
| 2 |
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DateTime
|
| 3 |
from sqlalchemy.orm import relationship
|
| 4 |
from sqlalchemy.sql import func
|
| 5 |
+
from backend.db.models.base import Base
|
| 6 |
|
| 7 |
class User(Base):
|
| 8 |
__tablename__ = "users"
|
backend/services/user_service.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# services/user_service.py
|
| 2 |
from sqlalchemy.orm import Session
|
| 3 |
-
from db.models import User, Role
|
| 4 |
-
from core.security import get_password_hash, verify_password
|
| 5 |
from typing import Optional, List
|
| 6 |
|
| 7 |
class UserService:
|
|
|
|
| 1 |
# services/user_service.py
|
| 2 |
from sqlalchemy.orm import Session
|
| 3 |
+
from backend.db.models import User, Role
|
| 4 |
+
from backend.core.security import get_password_hash, verify_password
|
| 5 |
from typing import Optional, List
|
| 6 |
|
| 7 |
class UserService:
|