Какие то правочки, туда сюда
This commit is contained in:
parent
3ff4df7386
commit
ba13e38690
3
main.py
3
main.py
@ -14,9 +14,6 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def lifespan(app: FastAPI):
|
async def lifespan(app: FastAPI):
|
||||||
await delete_tables()
|
|
||||||
logger.info("База данных очищена")
|
|
||||||
await create_tables()
|
|
||||||
logger.info("База данных готова к работе")
|
logger.info("База данных готова к работе")
|
||||||
yield
|
yield
|
||||||
logger.info("Выключение")
|
logger.info("Выключение")
|
||||||
|
1
model.py
1
model.py
@ -1,7 +1,6 @@
|
|||||||
import pickle
|
import pickle
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
from keras.src.legacy.preprocessing.text import Tokenizer
|
|
||||||
from keras.src.utils import pad_sequences
|
from keras.src.utils import pad_sequences
|
||||||
|
|
||||||
from enums import TypeMood, TypeModel
|
from enums import TypeMood, TypeModel
|
||||||
|
@ -42,7 +42,7 @@ class QuestionRepository:
|
|||||||
query = select(QuestionOrm).where(QuestionOrm.email_user == data.email_user)
|
query = select(QuestionOrm).where(QuestionOrm.email_user == data.email_user)
|
||||||
result = await session.execute(query)
|
result = await session.execute(query)
|
||||||
user_questions = result.scalars().all()
|
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)
|
oldest_question = min(user_questions, key=lambda q: q.question_time)
|
||||||
await session.delete(oldest_question)
|
await session.delete(oldest_question)
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import pandas as pd
|
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from enums import TypeMood
|
|
||||||
from schemas import Review
|
|
||||||
|
|
||||||
router = APIRouter(
|
router = APIRouter(
|
||||||
prefix="/class",
|
prefix="/class",
|
||||||
tags=["Class"],
|
tags=["Class"],
|
||||||
|
Loading…
Reference in New Issue
Block a user