|
@@ -28,15 +28,13 @@ from loguru import logger
|
|
from pangres import upsert
|
|
from pangres import upsert
|
|
from pydantic import BaseModel, Field
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
+
|
|
curr_path = os.path.abspath(os.path.dirname(__file__))
|
|
curr_path = os.path.abspath(os.path.dirname(__file__))
|
|
project_root_path = curr_path[:curr_path.find("video_to_word") + len("video_to_word")]
|
|
project_root_path = curr_path[:curr_path.find("video_to_word") + len("video_to_word")]
|
|
sys.path.append(project_root_path)
|
|
sys.path.append(project_root_path)
|
|
|
|
|
|
-# from script_score.lstm_network import SentimentNet
|
|
|
|
from config.url_and_db import toutiao_static_video_url, ai_word_engine
|
|
from config.url_and_db import toutiao_static_video_url, ai_word_engine
|
|
|
|
|
|
-random_num = random.random()
|
|
|
|
-print("OUT random_num", random_num)
|
|
|
|
|
|
|
|
with open('/data/pythonProject/video_to_word/script_score/pkl/vocab.pkl', 'rb') as f:
|
|
with open('/data/pythonProject/video_to_word/script_score/pkl/vocab.pkl', 'rb') as f:
|
|
vocab = pickle.load(f)
|
|
vocab = pickle.load(f)
|
|
@@ -211,6 +209,7 @@ def delete_script_score(item: DeleteScriptScoreRequest):
|
|
df=add_df,
|
|
df=add_df,
|
|
table_name='ctop_ai_script_score',
|
|
table_name='ctop_ai_script_score',
|
|
if_row_exists='update')
|
|
if_row_exists='update')
|
|
|
|
+ logger.info(f"request body: {item}, response body: {response}")
|
|
except:
|
|
except:
|
|
response.code = -1
|
|
response.code = -1
|
|
response.message = traceback.format_exc()
|
|
response.message = traceback.format_exc()
|
|
@@ -226,7 +225,6 @@ def delete_script_score(item: DeleteScriptScoreRequest):
|
|
summary="获取脚本评级列表",
|
|
summary="获取脚本评级列表",
|
|
response_model=GetScriptScoreLstResponse)
|
|
response_model=GetScriptScoreLstResponse)
|
|
def get_script_score_lst(item: ScriptScoreLstRequest):
|
|
def get_script_score_lst(item: ScriptScoreLstRequest):
|
|
- logger.info(f"request body: {item}")
|
|
|
|
response = GetScriptScoreLstResponse(message="查询成功")
|
|
response = GetScriptScoreLstResponse(message="查询成功")
|
|
try:
|
|
try:
|
|
end_date = item.end_date + timedelta(days=1)
|
|
end_date = item.end_date + timedelta(days=1)
|
|
@@ -259,7 +257,6 @@ def get_script_score_lst(item: ScriptScoreLstRequest):
|
|
response.message = traceback.format_exc()
|
|
response.message = traceback.format_exc()
|
|
response.success = False
|
|
response.success = False
|
|
logger.error(f"request body: {item}, response body: {response}")
|
|
logger.error(f"request body: {item}, response body: {response}")
|
|
-
|
|
|
|
return response
|
|
return response
|
|
|
|
|
|
|
|
|
|
@@ -301,13 +298,13 @@ def get_script_score(item: GetScriptScoreRequest):
|
|
con=ai_word_engine,
|
|
con=ai_word_engine,
|
|
if_exists='append',
|
|
if_exists='append',
|
|
index=False)
|
|
index=False)
|
|
-
|
|
|
|
- return response
|
|
|
|
|
|
+ logger.info(f"request body: {item}, response body: {response}")
|
|
except:
|
|
except:
|
|
response.code = -1
|
|
response.code = -1
|
|
response.success = False
|
|
response.success = False
|
|
response.message = traceback.format_exc()
|
|
response.message = traceback.format_exc()
|
|
- return response
|
|
|
|
|
|
+ logger.error(f"request body: {item}, response body: {response}")
|
|
|
|
+ return response
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|