'commit'
This commit is contained in:
@@ -12,26 +12,31 @@
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
background: white;
|
background: white;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
color: #333;
|
color: #333;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group {
|
.form-group {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="url"] {
|
input[type="url"] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -39,6 +44,7 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
background-color: #007bff;
|
background-color: #007bff;
|
||||||
color: white;
|
color: white;
|
||||||
@@ -49,23 +55,28 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:hover {
|
button:hover {
|
||||||
background-color: #0056b3;
|
background-color: #0056b3;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:disabled {
|
button:disabled {
|
||||||
background-color: #6c757d;
|
background-color: #6c757d;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-preview {
|
.image-preview {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-preview img {
|
.image-preview img {
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
border: 2px solid #ddd;
|
border: 2px solid #ddd;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.result {
|
.result {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
@@ -73,17 +84,20 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border-left: 4px solid #007bff;
|
border-left: 4px solid #007bff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.result img {
|
.result img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 400px;
|
max-height: 400px;
|
||||||
border: 2px solid #28a745;
|
border: 2px solid #28a745;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading {
|
.loading {
|
||||||
display: none;
|
display: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spinner {
|
.spinner {
|
||||||
border: 4px solid #f3f3f3;
|
border: 4px solid #f3f3f3;
|
||||||
border-top: 4px solid #007bff;
|
border-top: 4px solid #007bff;
|
||||||
@@ -93,10 +107,16 @@
|
|||||||
animation: spin 1s linear infinite;
|
animation: spin 1s linear infinite;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
0% { transform: rotate(0deg); }
|
0% {
|
||||||
100% { transform: rotate(360deg); }
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
color: #dc3545;
|
color: #dc3545;
|
||||||
background-color: #f8d7da;
|
background-color: #f8d7da;
|
||||||
@@ -105,6 +125,7 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.success {
|
.success {
|
||||||
color: #155724;
|
color: #155724;
|
||||||
background-color: #d4edda;
|
background-color: #d4edda;
|
||||||
@@ -113,6 +134,7 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 修改为横版模型卡片样式,一行显示3个 */
|
/* 修改为横版模型卡片样式,一行显示3个 */
|
||||||
.model-cards {
|
.model-cards {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -121,6 +143,7 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-card {
|
.model-card {
|
||||||
border: 2px solid #ddd;
|
border: 2px solid #ddd;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
@@ -133,15 +156,18 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
min-width: 280px;
|
min-width: 280px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-card:hover {
|
.model-card:hover {
|
||||||
border-color: #007bff;
|
border-color: #007bff;
|
||||||
transform: translateY(-2px);
|
transform: translateY(-2px);
|
||||||
box-shadow: 0 4px 15px rgba(0,123,255,0.2);
|
box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-card.selected {
|
.model-card.selected {
|
||||||
border-color: #007bff;
|
border-color: #007bff;
|
||||||
background-color: #e8f4fd;
|
background-color: #e8f4fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-card img {
|
.model-card img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
@@ -149,16 +175,19 @@
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-card h3 {
|
.model-card h3 {
|
||||||
margin: 10px 0 5px;
|
margin: 10px 0 5px;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-card p {
|
.model-card p {
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 新增:图片模态框样式 */
|
/* 新增:图片模态框样式 */
|
||||||
.modal {
|
.modal {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -172,10 +201,12 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
max-height: 90%;
|
max-height: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-modal {
|
.close-modal {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20px;
|
top: 20px;
|
||||||
@@ -185,20 +216,58 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-modal:hover {
|
.close-modal:hover {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
}
|
}
|
||||||
|
/* 新增:生成历史样式 */
|
||||||
|
.history-section {
|
||||||
|
margin-top: 40px;
|
||||||
|
padding-top: 20px;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
}
|
||||||
|
.history-title {
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.history-images {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 15px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.history-image-item {
|
||||||
|
width: calc(20% - 15px);
|
||||||
|
min-width: 120px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.history-image-item img {
|
||||||
|
width: 100%;
|
||||||
|
height: 250px; /* 修改为竖版高度 */
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 2px solid #ddd;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
.history-image-item img:hover {
|
||||||
|
border-color: #007bff;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
/* 响应式调整 */
|
/* 响应式调整 */
|
||||||
@media (max-width: 992px) {
|
@media (max-width: 992px) {
|
||||||
.model-card {
|
.model-card {
|
||||||
width: calc(50% - 15px);
|
width: calc(50% - 15px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.model-card {
|
.model-card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: auto;
|
min-width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-card img {
|
.model-card img {
|
||||||
height: 250px;
|
height: 250px;
|
||||||
}
|
}
|
||||||
@@ -206,39 +275,44 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>🎭 人像换脸生成器</h1>
|
<h1>🎭 人像换脸生成器</h1>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="imageUrl">图片URL地址:</label>
|
|
||||||
<input type="url" id="imageUrl" placeholder="请输入图片URL地址"
|
|
||||||
value="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>选择生成模型:</label>
|
<label>选择生成模型:</label>
|
||||||
<div class="model-cards" id="modelCards">
|
<div class="model-cards" id="modelCards">
|
||||||
<div class="model-card" onclick="selectModel(this, '炫酷机甲美女_majicflus')">
|
<div class="model-card" onclick="selectModel(this, '炫酷机甲美女_majicflus')">
|
||||||
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/Sample/JiJiaMeiNv.jpg"
|
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/Sample/JiJiaMeiNv.jpg"
|
||||||
alt="炫酷机甲美女" onerror="this.src='https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg'" onclick="openModal(this.src)">
|
alt="炫酷机甲美女"
|
||||||
|
onerror="this.src='https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg'"
|
||||||
|
onclick="openModal(this.src)">
|
||||||
<h3>炫酷机甲美女</h3>
|
<h3>炫酷机甲美女</h3>
|
||||||
<p>majicflus模型</p>
|
<p>majicflus模型</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="model-card" onclick="selectModel(this, '可铯AI—3d潮玩手办')">
|
<div class="model-card" onclick="selectModel(this, '可铯AI—3d潮玩手办')">
|
||||||
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/Sample/3DChaoWanShouBan.jpg"
|
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/Sample/3DChaoWanShouBan.jpg"
|
||||||
alt="3D潮玩手办" onerror="this.src='https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg'" onclick="openModal(this.src)">
|
alt="3D潮玩手办"
|
||||||
|
onerror="this.src='https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg'"
|
||||||
|
onclick="openModal(this.src)">
|
||||||
<h3>3D潮玩手办</h3>
|
<h3>3D潮玩手办</h3>
|
||||||
<p>可铯AI模型</p>
|
<p>可铯AI模型</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="model-card" onclick="selectModel(this, 'F.1-武侠世界')">
|
<div class="model-card" onclick="selectModel(this, 'F.1-武侠世界')">
|
||||||
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/Sample/WuXiaMeiNv.jpg"
|
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/Sample/WuXiaMeiNv.jpg"
|
||||||
alt="武侠世界" onerror="this.src='https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg'" onclick="openModal(this.src)">
|
alt="武侠世界"
|
||||||
|
onerror="this.src='https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg'"
|
||||||
|
onclick="openModal(this.src)">
|
||||||
<h3>武侠世界</h3>
|
<h3>武侠世界</h3>
|
||||||
<p>F.1武侠风格</p>
|
<p>F.1武侠风格</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="imageUrl">图片URL地址:</label>
|
||||||
|
<input type="url" id="imageUrl" placeholder="请输入图片URL地址"
|
||||||
|
value="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg">
|
||||||
|
</div>
|
||||||
<div class="image-preview" id="previewContainer">
|
<div class="image-preview" id="previewContainer">
|
||||||
<h3>参考图片预览:</h3>
|
<h3>参考图片预览:</h3>
|
||||||
<img id="previewImage" src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg"
|
<img id="previewImage" src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg"
|
||||||
@@ -257,15 +331,41 @@
|
|||||||
<div id="resultMessage"></div>
|
<div id="resultMessage"></div>
|
||||||
<div id="resultImage"></div>
|
<div id="resultImage"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 新增:生成历史栏目 -->
|
||||||
|
<div class="history-section">
|
||||||
|
<h3 class="history-title">📜 生成历史</h3>
|
||||||
|
<div class="history-images">
|
||||||
|
<div class="history-image-item">
|
||||||
|
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/bdde20e3143049c3916aa0b8d523b469.jpg"
|
||||||
|
alt="生成历史图片1" onclick="openModal(this.src)"/>
|
||||||
|
</div>
|
||||||
|
<div class="history-image-item">
|
||||||
|
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/bc5a75089f0047d990d7fe3cb6fbfab1.jpg"
|
||||||
|
alt="生成历史图片2" onclick="openModal(this.src)"/>
|
||||||
|
</div>
|
||||||
|
<div class="history-image-item">
|
||||||
|
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/ffe9051f1f1d4009a78c744b7e68747c.jpg"
|
||||||
|
alt="生成历史图片3" onclick="openModal(this.src)"/>
|
||||||
|
</div>
|
||||||
|
<div class="history-image-item">
|
||||||
|
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/484eba61d6e74f8ea0cb3d8ff2d14341.jpg"
|
||||||
|
alt="生成历史图片4" onclick="openModal(this.src)"/>
|
||||||
|
</div>
|
||||||
|
<div class="history-image-item">
|
||||||
|
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/215df7724cba4bf9a64e7863ecb4ebc0.jpg"
|
||||||
|
alt="生成历史图片5" onclick="openModal(this.src)"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 新增:图片模态框 -->
|
<!-- 新增:图片模态框 -->
|
||||||
<div id="imageModal" class="modal">
|
<div id="imageModal" class="modal">
|
||||||
<span class="close-modal" onclick="closeModal()">×</span>
|
<span class="close-modal" onclick="closeModal()">×</span>
|
||||||
<img class="modal-content" id="modalImage">
|
<img class="modal-content" id="modalImage">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const API_BASE = '/api/copyface';
|
const API_BASE = '/api/copyface';
|
||||||
let selectedModel = '';
|
let selectedModel = '';
|
||||||
// 新增:模态框相关变量
|
// 新增:模态框相关变量
|
||||||
@@ -273,7 +373,7 @@
|
|||||||
const modalImage = document.getElementById('modalImage');
|
const modalImage = document.getElementById('modalImage');
|
||||||
|
|
||||||
// 页面加载时初始化
|
// 页面加载时初始化
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
// 默认选择第一个模型
|
// 默认选择第一个模型
|
||||||
const firstCard = document.querySelector('.model-card');
|
const firstCard = document.querySelector('.model-card');
|
||||||
if (firstCard) {
|
if (firstCard) {
|
||||||
@@ -281,7 +381,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 监听URL输入变化,实时预览
|
// 监听URL输入变化,实时预览
|
||||||
document.getElementById('imageUrl').addEventListener('input', function() {
|
document.getElementById('imageUrl').addEventListener('input', function () {
|
||||||
const url = this.value.trim();
|
const url = this.value.trim();
|
||||||
const previewImg = document.getElementById('previewImage');
|
const previewImg = document.getElementById('previewImage');
|
||||||
if (url) {
|
if (url) {
|
||||||
@@ -305,7 +405,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 点击模态框背景也关闭
|
// 点击模态框背景也关闭
|
||||||
window.onclick = function(event) {
|
window.onclick = function (event) {
|
||||||
if (event.target == modal) {
|
if (event.target == modal) {
|
||||||
closeModal();
|
closeModal();
|
||||||
}
|
}
|
||||||
@@ -406,6 +506,6 @@
|
|||||||
loading.style.display = 'none';
|
loading.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Reference in New Issue
Block a user