
模型翻译api服务代码
import os
import json
import logging
from logging.handlers import RotatingFileHandler
from datetime import datetime
from flask import Flask, request,jsonify
from gevent import pywsgi
from transformers import pipeline, AutoModelWithLMHead, AutoTokenizer
import warnings, requests
warnings.filterwarnings('ignore')try:print('\n 翻译服务\n')logger = logging.getLogger('requests')logger.setLevel(logging.DEBUG)log_filename = './logs/'+datetime.now().strftime('%Y%m%d') + '.log'file_handler = RotatingFileHandler(log_filename, maxBytes=1024