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

28 lines
725 B
Python

import pandas as pd
from fastapi import APIRouter
from typing import List
from enums import TypeMood
from schemas import Review
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