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

26 lines
823 B
Python
Raw Normal View History

from typing import Annotated
from fastapi import APIRouter, Depends
from typing import List
from enums import TypeMood, TypeModel
from repository import QuestionRepository
from schemas import SQuestionAdd, SQuestion, SQuestionId
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