python手动复制提示词版本剧本生成多集多片段seedance2分镜提示词及参考图代码bfwfilmer代码
代码语言:python
所属分类:其他
代码描述:python手动复制提示词版本剧本生成多集多片段seedance2分镜提示词及参考图代码bfwfilmer代码,可以输入剧本或主题,设置集数和每集时长,生成提示词到免费大模型获取json数据后,自动生成分集及角色道具场景文生图提示词,还有每一集的片段分镜seedance2提示词。
代码标签: python 手动 复制 提示词 版本 剧本 生成 多集 多 片段 seedance 分镜 提示词
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
#!/usr/bin/env python3
"""
手动AI短剧生成器工具 (专业商用版) - FastAPI 框架版
包含:10秒分镜升级、支持鼠标悬浮一键粘贴上传、按片段显示及下载专属垫图(完整不裁切)。
"""
import os
import shutil
import subprocess
from pathlib import Path
import uvicorn
from fastapi import FastAPI, UploadFile, File, Form
from fastapi.responses import HTMLResponse, JSONResponse
from fastapi.staticfiles import StaticFiles
from pydantic import BaseModel
from typing import List
# ================= 配置与初始化 =================
PORT = 8080
UPLOAD_DIR = Path("uploads")
PROJECTS_DIR = UPLOAD_DIR / "projects"
PROJECTS_DIR.mkdir(parents=True, exist_ok=True)
app = FastAPI(title="AI 短剧创作工作台")
# 挂载静态文件目录,让前端可以直接访问上传的图片和视频
app.mount("/uploads", StaticFiles(directory="uploads"), name="uploads")
# ================= 前端 HTML 内容 =================
HTML_CONTENT = r'''<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI短剧创作工作台</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-base: #09090b;
--bg-surface: #18181b;
--bg-surface-hover: #27272a;
--border: #27272a;
--border-hover: #3f3f46;
--text-primary: #f4f4f5;
--text-secondary: #a1a1aa;
--text-muted: #71717a;
--primary: #3b82f6;
--primary-hover: #2563eb;
--danger: #ef4444;
--danger-hover: #dc2626;
--success: #10b981;
--warning: #f59e0b;
--radius-sm: 6px;
--radius-md: 10px;
--radius-lg: 16px;
--shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Inter', system-ui, -apple-system, sans-serif;
background: var(--bg-base);
color: var(--text-primary);
min-height: 100vh;
line-height: 1.6;
}
/* Navbar */
.navbar {
background: rgba(24, 24, 27, 0.8);
backdrop-filter: blur(12px);
border-bottom: 1px solid var(--border);
padding: 16px 32px;
display: flex;
align-items: center;
justify-content: space-between;
position: sticky;
top: 0;
z-index: 100;
}
.navbar .brand {
font-size: 18px;
font-weight: 600;
display: flex;
align-items: center;
gap: 10px;
color: var(--text-primary);
}
.navbar .brand-icon {
background: linear-gradient(135deg, var(--primary), #8b5cf6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 22px;
}
.navbar .project-info {
font-size: 14px;
color: var(--text-secondary);
display: flex;
align-items: center;
gap: 8px;
}
/* Layouts */
.container { max-width: 1200px; margin: 0 auto; padding: 40px 20px; }
.hidden { display: none !important; }
/* Buttons */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 10px 18px;
border-radius: var(--radius-sm);
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
border: 1px solid transparent;
}
.btn-primary {
background: var(--primary);
color: white;
box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
background: transparent;
border: 1px solid var(--border);
color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-surface-hover); border-color: var(--border-hover); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
/* Dashboard Cards */
.grid-projects {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
margin-top: 24px;
}
.project-card {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 24px;
transition: all 0.3s;
cursor: pointer;
display: flex;
flex-direction: column;
}
.project-card:hover {
border-color: var(--primary);
transform: translateY(-2px);
box-shadow: var(--shadow);
}
.project-card h3 { font-size: 18px; margin-bottom: 8px; font-weight: 600; }
.project-card .meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; }
.project-card .tags { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tag {
background: var(--bg-base);
border: 1px solid var(--border);
padding: 4px 10px;
border-radius: 20px;
font-size: 11px;
color: var(--text-secondary);
}
.project-card .actions {
margin-top: auto;
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 16px;
border-top: 1px solid var(--border);
}
/* Forms & Inputs */
.form-group { margin-bottom: 20px; }
.form-group label {
display: block;
font-size: 13px;
font-weight: 500;
color: var(--text-secondary);
margin-bottom: 8px;
}
input[type="text"], input[type="number"], textarea, select {
width: 100%;
background: var(--bg-base);
border: 1px solid var(--border);
color: var(--text-primary);
border-radius: var(--radius-sm);
padding: 12px 16px;
font-family: inherit;
font-size: 14px;
transition: border 0.2s;
}
input:focus, textarea:focus, select:focus {
outline: none;
border-color: var(--primary);
}
textarea { resize: vertical; min-height: 100px; }
/* Modals */
.modal-overlay {
position: fixed; top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.8);
backdrop-filter: blur(4px);
display: flex; align-items: center; justify-content: center;
z-index: 1000;
opacity: 0; pointer-events: none;
transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
width: 90%; max-width: 500px;
padding: 30px;
box-shadow: var(--shadow);
transform: translateY(20px);
transition: transform 0.3s;
max-height: 90vh;
overflow-y: auto;
}
.modal.large { max-width: 800px; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { font-size: 20px; font-weight: 600; }
.close-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 20px; }
/* Stepper */
.stepper {
display: flex;
justify-content: space-between;
margin-bottom: 40px;
position: relative;
}
.stepper::before {
content: '';
position: absolute;
top: 16px; left: 0; right: 0;
height: 2px;
background: var(--border);
z-index: 1;
}
.step {
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
cursor: pointer;
width: 25%;
}
.step .circle {
width: 34px; height: 34px;
background: var(--bg-surface);
border: 2px solid var(--border);
border-radius: 50%;
display: flex; align-items: center; justify-content: center;
font-size: 14px; font-weight: 600;
color: var(--text-secondary);
transition: all 0.3s;
}
.step.active .circle {
border-color: var(--primary);
background: var(--primary);
color: white;
box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}
.step.completed .circle {
border-color: var(--success);
color: var(--success);
}
.step .label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.step.active .label { color: var(--text-primary); }
/* Workspace Cards */
.card {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 24px;
margin-bottom: 24px;
}
.card-header {
display: flex; align-items: center; gap: 10px;
margin-bottom: 20px;
}
.card-header h2 { font-size: 18px; font-weight: 600; }
/* Prompt Box */
.prompt-box {
background: var(--bg-base);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: 16px;
font-size: 13px;
color: #d4d4d8;
line-height: 1.7;
white-space: pre-wrap;
position: relative;
max-height: 300px;
overflow-y: auto;
}
.prompt-box .copy-btn {
position: absolute;
top: 10px; right: 10px;
}
/* Upload & Grid */
.upload-zone {
border: 2px dashed var(--border);
border-radius: var(--radius-md);
padding: 30px 20px;
text-align: center;
cursor: pointer;
transition: all 0.3s;
background: rgba(255,255,255,0.02);
}
.upload-zone:hover {
border-color: var(--primary);
background: rgba(59, 130, 246, 0.05);
}
.image-preview { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.img-item {
width: 110px; height: 130px;
border-radius: var(--radius-sm);
overflow: hidden;
position: relative;
border: 2px solid var(--border);
background: #000;
}
.img-item.active-version { border-color: var(--success); box-shadow: 0 0 8px rgba(16,185,129,0.3); }
.img-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; transition: opacity 0.2s;}
.img-item img:hover { opacity: 0.8; }
.img-item .remove {
position: absolute; top: 4px; right: 4px;
background: rgba(0,0,0,0.6); color: white; border: none;
border-radius: 50%; width: 22px; height: 22px;
font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.img-item .version-btn {
position: absolute; bottom: 0; left: 0; right: 0;
background: rgba(0,0,0,0.8); color: white; border: none;
font-size: 11px; padding: 6px; cursor: pointer; transition: 0.2s;
}
.img-item .version-btn:hover { background: var(--success); }
.img-item .active-badge {
position: absolute; bottom: 0; left: 0; right: 0;
background: var(--success); color: white; text-align: center;
font-size: 11px; padding: 6px; font-weight: bold;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media(max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }
/* Toast */
.toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
background: var(--bg-s.........完整代码请登录后点击上方下载按钮下载查看















网友评论0