From ba13e386908f45cb93538a2ff3e2e9f8feaac060 Mon Sep 17 00:00:00 2001 From: maksim Date: Sat, 8 Jun 2024 00:41:50 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=B0=D0=BA=D0=B8=D0=B5=20=D1=82=D0=BE?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BE=D1=87=D0=BA=D0=B8,=20=D1=82?= =?UTF-8?q?=D1=83=D0=B4=D0=B0=20=D1=81=D1=8E=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 3 --- model.py | 1 - repository.py | 2 +- router_class.py | 4 ---- 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/main.py b/main.py index 859da49..3445756 100644 --- a/main.py +++ b/main.py @@ -14,9 +14,6 @@ logger = logging.getLogger(__name__) @asynccontextmanager async def lifespan(app: FastAPI): - await delete_tables() - logger.info("База данных очищена") - await create_tables() logger.info("База данных готова к работе") yield logger.info("Выключение") diff --git a/model.py b/model.py index 714f4eb..922b02f 100644 --- a/model.py +++ b/model.py @@ -1,7 +1,6 @@ import pickle import numpy as np import tensorflow as tf -from keras.src.legacy.preprocessing.text import Tokenizer from keras.src.utils import pad_sequences from enums import TypeMood, TypeModel diff --git a/repository.py b/repository.py index df09748..0d09d4b 100644 --- a/repository.py +++ b/repository.py @@ -42,7 +42,7 @@ class QuestionRepository: query = select(QuestionOrm).where(QuestionOrm.email_user == data.email_user) result = await session.execute(query) user_questions = result.scalars().all() - if len(user_questions) > 10: + if len(user_questions) > 100: # Удаление самой старой записи oldest_question = min(user_questions, key=lambda q: q.question_time) await session.delete(oldest_question) diff --git a/router_class.py b/router_class.py index 686d129..7a5b313 100644 --- a/router_class.py +++ b/router_class.py @@ -1,10 +1,6 @@ -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"],