PIbd-32_Kashin_M.I_API_Cour.../router_class.py

27 lines
694 B
Python
Raw Normal View History

from fastapi import APIRouter
from typing import List
2024-06-08 01:22:35 +04:00
from repository import QuestionRepository
router = APIRouter(
prefix="/class",
tags=["Class"],
)
@router.get("/negative")
async def get_class_names() -> List[str]:
with open(".//neural_network/classification/class_names_negative.txt", "r", encoding="utf-8") as file:
class_names = [line.strip() for line in file.readlines()]
return class_names
@router.get("/positive")
async def get_class_names() -> List[str]:
with open(".//neural_network/classification/class_names_positive.txt", "r", encoding="utf-8") as file:
class_names = [line.strip() for line in file.readlines()]
return class_names
2024-06-08 01:22:35 +04:00