完成训练模块的转移
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
# @IDE : PyCharm
|
||||
# @desc : 全局事件
|
||||
|
||||
|
||||
import torch
|
||||
from fastapi import FastAPI
|
||||
from motor.motor_asyncio import AsyncIOMotorClient
|
||||
from application.settings import REDIS_DB_URL, MONGO_DB_URL, MONGO_DB_NAME, EVENTS
|
||||
@ -68,6 +68,9 @@ async def connect_redis(app: FastAPI, status: bool):
|
||||
response = await rd.ping()
|
||||
if response:
|
||||
print("Redis 连接成功")
|
||||
# 数据初始化
|
||||
is_gpu = torch.cuda.is_available()
|
||||
rd.set('is_gpu', str(is_gpu))
|
||||
else:
|
||||
print("Redis 连接失败")
|
||||
except AuthenticationError as e:
|
||||
|
Reference in New Issue
Block a user