from typing import Annotated from fastapi import APIRouter, Depends, HTTPException from typing import List from pydantic import ValidationError from enums import TypeMood, TypeModel from genetic_algorithm.genetic_algorithm import genetic_algorithm, load_graph_from_request from repository import QuestionRepository from schemas import SQuestionAdd, SQuestion, SQuestionId, Flight, TripRequest router = APIRouter( prefix="/class", tags=["Class"], ) @router.post("/get_flight/") async def get_flight(request: TripRequest): graph, start_point, end_point = load_graph_from_request(request) best_path, length, start_time, end_time = genetic_algorithm(start_point, end_point, graph) return best_path, length, start_time, end_time @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