代码拉取完成,页面将自动刷新
同步操作将从 小南橙/Flask-application 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
from flask import Flask, render_template, session, redirect, url_for, request, jsonify
# from flask_cors import CORS #跨域
app = Flask(__name__)
# CORS(app, resources=r'/*') # 注册CORS, "/*" 允许访问所有api
#从工具中导入需要的功能函数
from tools.imageColor import dragColor
from tools.shotvideo import genFrame
from tools.getSubtitle import GetSubtitle
from tools.OCR import getOCR
from tools.text import read_deal_text
from tools.face import get_face_res
@app.route('/')
def home():#首页
return render_template('index.html',active="home")
@app.route('/shot')
def shot():#分镜
#
pic="static/img/image" #分镜结果目录
# framecount=genFrame()# 正式使用需要将这行注释取消 下面这行注释
framecount=[92, 192, 227]
return render_template('shot.html',pic1=pic,framecount=framecount,active="shot")
@app.route("/get_colors")
def get_colors():#视频关键帧的色彩提取
img_id =request.args.get("id",None)
if img_id:#判断是否有图片的id 有的话返回颜色提取结果 否则返回整个分镜结果 注释同分镜
colors,colors_hex = dragColor(f"./static/img/image{img_id}.jpg")
return render_template("get_color.html",img_id=img_id,colors=colors,colors_hex=colors_hex,active="get_colors")
pic="static/img/image"
# framecount=genFrame()
framecount=[92, 192, 227]
return render_template("get_color.html",flag=True,pic1=pic,framecount=framecount,active="get_colors")
@app.route("/get_subtitle")
def get_subtitle():# 视频中字幕提取识别 直接返回前端页面
return render_template("get_subtitle.html",active="get_subtitle")
@app.route("/get_res")
def get_res():#获取字幕结果 由于时间过长 单独处理 前端使用ajax异步向后端请求
res=GetSubtitle()
return jsonify({'data':res})
@app.route("/text")
def text():
text_name =request.args.get("name",None)
if text_name:
counts,save_file_path=read_deal_text(text_name)
return jsonify({'counts':counts,'save_file_path':save_file_path})
counts,save_file_path=read_deal_text()
return render_template("text.html",active="text",counts=counts,save_file_path=save_file_path)
@app.route("/face")
def face():
face_path=r".\static\img\face1.jpeg"
face_alignment_res,face_detect_res=get_face_res()
return render_template("face.html",active="face",face_alignment_res=face_alignment_res,face_detect_res=face_detect_res,face_path=face_path)
if __name__ == '__main__':
app.run(host='127.0.0.1', port=5001,debug=True)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。