mirror of
https://github.com/linyqh/NarratoAI.git
synced 2025-12-11 02:12:50 +00:00
refactor: 移除视频审查功能及相关代码
删除不再使用的视频审查功能,包括移除相关面板组件、i18n翻译条目和主程序中的调用
This commit is contained in:
parent
864ebea1be
commit
60e01bf6f2
7
webui.py
7
webui.py
@ -4,7 +4,7 @@ import sys
|
||||
from loguru import logger
|
||||
from app.config import config
|
||||
from webui.components import basic_settings, video_settings, audio_settings, subtitle_settings, script_settings, \
|
||||
review_settings, system_settings
|
||||
system_settings
|
||||
# from webui.utils import cache, file_utils
|
||||
from app.utils import utils
|
||||
from app.utils import ffmpeg_utils
|
||||
@ -227,14 +227,11 @@ def main():
|
||||
with panel[0]:
|
||||
script_settings.render_script_panel(tr)
|
||||
with panel[1]:
|
||||
video_settings.render_video_panel(tr)
|
||||
audio_settings.render_audio_panel(tr)
|
||||
with panel[2]:
|
||||
video_settings.render_video_panel(tr)
|
||||
subtitle_settings.render_subtitle_panel(tr)
|
||||
|
||||
# 渲染视频审查面板
|
||||
review_settings.render_review_panel(tr)
|
||||
|
||||
# 放到最后渲染可能使用PyTorch的部分
|
||||
# 渲染系统设置面板
|
||||
with panel[2]:
|
||||
|
||||
@ -3,13 +3,11 @@ from .script_settings import render_script_panel
|
||||
from .video_settings import render_video_panel
|
||||
from .audio_settings import render_audio_panel
|
||||
from .subtitle_settings import render_subtitle_panel
|
||||
from .review_settings import render_review_panel
|
||||
|
||||
__all__ = [
|
||||
'render_basic_settings',
|
||||
'render_script_panel',
|
||||
'render_video_panel',
|
||||
'render_audio_panel',
|
||||
'render_subtitle_panel',
|
||||
'render_review_panel'
|
||||
]
|
||||
'render_subtitle_panel'
|
||||
]
|
||||
@ -1,88 +0,0 @@
|
||||
import streamlit as st
|
||||
import os
|
||||
from loguru import logger
|
||||
|
||||
|
||||
def render_review_panel(tr):
|
||||
"""渲染视频审查面板"""
|
||||
with st.expander(tr("Video Check"), expanded=False):
|
||||
try:
|
||||
video_list = st.session_state.get('video_clip_json', [])
|
||||
subclip_videos = st.session_state.get('subclip_videos', {})
|
||||
except KeyError:
|
||||
video_list = []
|
||||
subclip_videos = {}
|
||||
|
||||
# 计算列数和行数
|
||||
num_videos = len(video_list)
|
||||
cols_per_row = 3
|
||||
rows = (num_videos + cols_per_row - 1) // cols_per_row # 向上取整计算行数
|
||||
|
||||
# 使用容器展示视频
|
||||
for row in range(rows):
|
||||
cols = st.columns(cols_per_row)
|
||||
for col in range(cols_per_row):
|
||||
index = row * cols_per_row + col
|
||||
if index < num_videos:
|
||||
with cols[col]:
|
||||
render_video_item(tr, video_list, subclip_videos, index)
|
||||
|
||||
|
||||
def render_video_item(tr, video_list, subclip_videos, index):
|
||||
"""渲染单个视频项"""
|
||||
video_script = video_list[index]
|
||||
|
||||
# 显示时间戳
|
||||
timestamp = video_script.get('_id', '')
|
||||
st.text_area(
|
||||
tr("Timestamp"),
|
||||
value=timestamp,
|
||||
height=70,
|
||||
disabled=True,
|
||||
key=f"timestamp_{index}"
|
||||
)
|
||||
|
||||
# 显示视频播放器
|
||||
video_path = subclip_videos.get(timestamp)
|
||||
if video_path and os.path.exists(video_path):
|
||||
try:
|
||||
st.video(video_path)
|
||||
except Exception as e:
|
||||
logger.error(f"加载视频失败 {video_path}: {e}")
|
||||
st.error(f"无法加载视频: {os.path.basename(video_path)}")
|
||||
else:
|
||||
st.warning(tr("视频文件未找到"))
|
||||
|
||||
# 显示画面描述
|
||||
st.text_area(
|
||||
tr("Picture Description"),
|
||||
value=video_script.get('picture', ''),
|
||||
height=150,
|
||||
disabled=True,
|
||||
key=f"picture_{index}"
|
||||
)
|
||||
|
||||
# 显示旁白文本
|
||||
narration = st.text_area(
|
||||
tr("Narration"),
|
||||
value=video_script.get('narration', ''),
|
||||
height=150,
|
||||
key=f"narration_{index}"
|
||||
)
|
||||
# 保存修改后的旁白文本
|
||||
if narration != video_script.get('narration', ''):
|
||||
video_script['narration'] = narration
|
||||
st.session_state['video_clip_json'] = video_list
|
||||
|
||||
# 显示剪辑模式
|
||||
ost = st.selectbox(
|
||||
tr("Clip Mode"),
|
||||
options=range(0, 3),
|
||||
index=video_script.get('OST', 0),
|
||||
key=f"ost_{index}",
|
||||
help=tr("0: Keep the audio only, 1: Keep the original sound only, 2: Keep the original sound and audio")
|
||||
)
|
||||
# 保存修改后的剪辑模式
|
||||
if ost != video_script.get('OST', 0):
|
||||
video_script['OST'] = ost
|
||||
st.session_state['video_clip_json'] = video_list
|
||||
@ -333,7 +333,7 @@ def render_script_buttons(tr, params):
|
||||
video_clip_json_details = st.text_area(
|
||||
tr("Video Script"),
|
||||
value=json.dumps(st.session_state.get('video_clip_json', []), indent=2, ensure_ascii=False),
|
||||
height=180
|
||||
height=500
|
||||
)
|
||||
|
||||
# 操作按钮行 - 合并格式检查和保存功能
|
||||
|
||||
@ -81,7 +81,6 @@
|
||||
"TTS Provider": "语音合成提供商",
|
||||
"Hide Log": "隐藏日志",
|
||||
"Upload Local Files": "上传本地文件",
|
||||
"Video Check": "视频审查",
|
||||
"File Uploaded Successfully": "文件上传成功",
|
||||
"timestamp": "时间戳",
|
||||
"Picture description": "图片描述",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user