Spaces:
Running
Running
Commit ·
6c84e1a
1
Parent(s): 7bec57d
跳转
Browse files- index.html +166 -11
- style.css +49 -4
index.html
CHANGED
|
@@ -2,20 +2,175 @@
|
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8" />
|
| 5 |
-
<meta name="viewport" content="width=device-width" />
|
| 6 |
-
<title>
|
| 7 |
<link rel="stylesheet" href="style.css" />
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
-
<div class="
|
| 11 |
-
<
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
</body>
|
| 21 |
</html>
|
|
|
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
+
<title>Stable Diffusion - Demo UI</title>
|
| 7 |
<link rel="stylesheet" href="style.css" />
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
+
<div class="hf-app">
|
| 11 |
+
<header class="hf-header">
|
| 12 |
+
<div class="logo" aria-hidden="true">
|
| 13 |
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
| 14 |
+
<defs>
|
| 15 |
+
<linearGradient id="g" x1="0" y1="0" x2="24" y2="24" gradientUnits="userSpaceOnUse">
|
| 16 |
+
<stop stop-color="#ff8a00" />
|
| 17 |
+
<stop offset="1" stop-color="#ff4d4d" />
|
| 18 |
+
</linearGradient>
|
| 19 |
+
</defs>
|
| 20 |
+
<rect x="2" y="2" width="20" height="20" rx="5" fill="url(#g)" />
|
| 21 |
+
<path d="M8 8.5h8M8 12h6M8 15.5h8" stroke="white" stroke-width="1.8" stroke-linecap="round"/>
|
| 22 |
+
</svg>
|
| 23 |
+
</div>
|
| 24 |
+
<div class="titles">
|
| 25 |
+
<h1>Stable Diffusion 图片生成器</h1>
|
| 26 |
+
<p class="subtitle">Hugging Face 风格的纯前端演示界面(仅 UI,无后端)。</p>
|
| 27 |
+
</div>
|
| 28 |
+
</header>
|
| 29 |
+
|
| 30 |
+
<main class="hf-main">
|
| 31 |
+
<section class="panel controls">
|
| 32 |
+
<div class="group">
|
| 33 |
+
<label for="prompt">Prompt</label>
|
| 34 |
+
<textarea id="prompt" rows="4" placeholder="例如:a cozy room with a sleeping orange cat, soft light, ultra-detailed, 8k"></textarea>
|
| 35 |
+
</div>
|
| 36 |
+
<div class="group">
|
| 37 |
+
<label for="neg">Negative Prompt</label>
|
| 38 |
+
<textarea id="neg" rows="3" placeholder="例如:lowres, blurry, artifacts, extra fingers"></textarea>
|
| 39 |
+
</div>
|
| 40 |
+
<div class="row">
|
| 41 |
+
<div class="field">
|
| 42 |
+
<label for="width">宽度</label>
|
| 43 |
+
<select id="width">
|
| 44 |
+
<option>512</option>
|
| 45 |
+
<option selected>768</option>
|
| 46 |
+
<option>896</option>
|
| 47 |
+
<option>1024</option>
|
| 48 |
+
</select>
|
| 49 |
+
</div>
|
| 50 |
+
<div class="field">
|
| 51 |
+
<label for="height">高度</label>
|
| 52 |
+
<select id="height">
|
| 53 |
+
<option>512</option>
|
| 54 |
+
<option selected>768</option>
|
| 55 |
+
<option>896</option>
|
| 56 |
+
<option>1024</option>
|
| 57 |
+
</select>
|
| 58 |
+
</div>
|
| 59 |
+
</div>
|
| 60 |
+
<div class="row">
|
| 61 |
+
<div class="field">
|
| 62 |
+
<label for="steps">Steps <span class="value" id="stepsVal">30</span></label>
|
| 63 |
+
<input id="steps" type="range" min="1" max="100" value="30" />
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
<div class="row">
|
| 67 |
+
<div class="field">
|
| 68 |
+
<label for="cfg">Guidance Scale <span class="value" id="cfgVal">7.0</span></label>
|
| 69 |
+
<input id="cfg" type="range" min="1" max="20" step="0.5" value="7" />
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
<div class="row">
|
| 73 |
+
<div class="field">
|
| 74 |
+
<label for="sampler">采样器</label>
|
| 75 |
+
<select id="sampler">
|
| 76 |
+
<option>Euler</option>
|
| 77 |
+
<option>DPM++ 2M</option>
|
| 78 |
+
<option>Heun</option>
|
| 79 |
+
<option>Euler a</option>
|
| 80 |
+
</select>
|
| 81 |
+
</div>
|
| 82 |
+
<div class="field">
|
| 83 |
+
<label for="seed">Seed</label>
|
| 84 |
+
<input id="seed" type="text" placeholder="随机" />
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
<div class="row">
|
| 88 |
+
<div class="field">
|
| 89 |
+
<label for="batch">每批数量</label>
|
| 90 |
+
<select id="batch">
|
| 91 |
+
<option selected>1</option>
|
| 92 |
+
<option>2</option>
|
| 93 |
+
<option>4</option>
|
| 94 |
+
<option>8</option>
|
| 95 |
+
</select>
|
| 96 |
+
</div>
|
| 97 |
+
<div class="field">
|
| 98 |
+
<label> </label>
|
| 99 |
+
<button id="generateBtn" class="primary">生成</button>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
<p class="disclaimer">此页面仅为演示 UI,不会调用任何模型或上传图像。</p>
|
| 103 |
+
</section>
|
| 104 |
+
|
| 105 |
+
<section class="panel output">
|
| 106 |
+
<div class="toolbar">
|
| 107 |
+
<div class="tag">SD 1.5</div>
|
| 108 |
+
<div class="tag secondary">无 API(演示)</div>
|
| 109 |
+
</div>
|
| 110 |
+
<div id="gallery" class="gallery">
|
| 111 |
+
<div class="tile skeleton"></div>
|
| 112 |
+
<div class="tile skeleton"></div>
|
| 113 |
+
<div class="tile skeleton"></div>
|
| 114 |
+
<div class="tile skeleton"></div>
|
| 115 |
+
</div>
|
| 116 |
+
</section>
|
| 117 |
+
</main>
|
| 118 |
+
|
| 119 |
+
<footer class="hf-footer">
|
| 120 |
+
<p>Made with ❤️ — 静态页面示例</p>
|
| 121 |
+
</footer>
|
| 122 |
</div>
|
| 123 |
+
|
| 124 |
+
<script>
|
| 125 |
+
const steps = document.getElementById('steps');
|
| 126 |
+
const stepsVal = document.getElementById('stepsVal');
|
| 127 |
+
const cfg = document.getElementById('cfg');
|
| 128 |
+
const cfgVal = document.getElementById('cfgVal');
|
| 129 |
+
const generateBtn = document.getElementById('generateBtn');
|
| 130 |
+
const gallery = document.getElementById('gallery');
|
| 131 |
+
const batch = document.getElementById('batch');
|
| 132 |
+
|
| 133 |
+
function updateOutput(el, outEl, factor = 1) {
|
| 134 |
+
outEl.textContent = (el.value * factor).toFixed(factor === 1 ? 0 : 1);
|
| 135 |
+
}
|
| 136 |
+
steps.addEventListener('input', () => updateOutput(steps, stepsVal));
|
| 137 |
+
cfg.addEventListener('input', () => updateOutput(cfg, cfgVal, 1));
|
| 138 |
+
|
| 139 |
+
function skeleton(n) {
|
| 140 |
+
gallery.innerHTML = '';
|
| 141 |
+
for (let i = 0; i < n; i++) {
|
| 142 |
+
const d = document.createElement('div');
|
| 143 |
+
d.className = 'tile skeleton';
|
| 144 |
+
gallery.appendChild(d);
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
function fakeGenerate() {
|
| 149 |
+
const n = parseInt(batch.value || '1', 10);
|
| 150 |
+
skeleton(Math.min(Math.max(n, 1), 8));
|
| 151 |
+
generateBtn.disabled = true;
|
| 152 |
+
generateBtn.textContent = '生成中...';
|
| 153 |
+
const seeds = Array.from({ length: n }, (_, i) => `${Date.now()}-${i}`);
|
| 154 |
+
setTimeout(() => {
|
| 155 |
+
gallery.innerHTML = '';
|
| 156 |
+
seeds.forEach((s) => {
|
| 157 |
+
const tile = document.createElement('div');
|
| 158 |
+
tile.className = 'tile';
|
| 159 |
+
const img = document.createElement('img');
|
| 160 |
+
img.alt = 'sample';
|
| 161 |
+
img.loading = 'lazy';
|
| 162 |
+
img.src = `https://picsum.photos/seed/${encodeURIComponent(s)}/768/768`;
|
| 163 |
+
tile.appendChild(img);
|
| 164 |
+
gallery.appendChild(tile);
|
| 165 |
+
});
|
| 166 |
+
generateBtn.disabled = false;
|
| 167 |
+
generateBtn.textContent = '生成';
|
| 168 |
+
}, 900 + n * 150);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
generateBtn.addEventListener('click', () => {
|
| 172 |
+
window.location.href = 'https://seedance10.com';
|
| 173 |
+
});
|
| 174 |
+
</script>
|
| 175 |
</body>
|
| 176 |
</html>
|
style.css
CHANGED
|
@@ -1,16 +1,18 @@
|
|
| 1 |
body {
|
| 2 |
padding: 2rem;
|
| 3 |
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
h1 {
|
| 7 |
-
font-size:
|
| 8 |
margin-top: 0;
|
| 9 |
}
|
| 10 |
|
| 11 |
p {
|
| 12 |
-
color: rgb(
|
| 13 |
-
font-size:
|
| 14 |
margin-bottom: 10px;
|
| 15 |
margin-top: 5px;
|
| 16 |
}
|
|
@@ -19,10 +21,53 @@ p {
|
|
| 19 |
max-width: 620px;
|
| 20 |
margin: 0 auto;
|
| 21 |
padding: 16px;
|
| 22 |
-
border: 1px solid
|
| 23 |
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
.card p:last-child {
|
| 27 |
margin-bottom: 0;
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
padding: 2rem;
|
| 3 |
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
| 4 |
+
background: #0b0c10;
|
| 5 |
+
color: #e6e6e6;
|
| 6 |
}
|
| 7 |
|
| 8 |
h1 {
|
| 9 |
+
font-size: 18px;
|
| 10 |
margin-top: 0;
|
| 11 |
}
|
| 12 |
|
| 13 |
p {
|
| 14 |
+
color: rgb(163, 166, 176);
|
| 15 |
+
font-size: 14px;
|
| 16 |
margin-bottom: 10px;
|
| 17 |
margin-top: 5px;
|
| 18 |
}
|
|
|
|
| 21 |
max-width: 620px;
|
| 22 |
margin: 0 auto;
|
| 23 |
padding: 16px;
|
| 24 |
+
border: 1px solid rgba(255,255,255,0.08);
|
| 25 |
border-radius: 16px;
|
| 26 |
}
|
| 27 |
|
| 28 |
.card p:last-child {
|
| 29 |
margin-bottom: 0;
|
| 30 |
}
|
| 31 |
+
|
| 32 |
+
/* --- Hugging Face like layout --- */
|
| 33 |
+
.hf-app { max-width: 1100px; margin: 0 auto; }
|
| 34 |
+
|
| 35 |
+
.hf-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
|
| 36 |
+
.hf-header .logo { width: 32px; height: 32px; display: grid; place-items: center; }
|
| 37 |
+
.hf-header .titles .subtitle { margin-top: 2px; font-size: 13px; color: #b8bdc7; }
|
| 38 |
+
|
| 39 |
+
.hf-main { display: grid; grid-template-columns: 340px 1fr; gap: 16px; }
|
| 40 |
+
.panel { background: #111218; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 14px; }
|
| 41 |
+
|
| 42 |
+
.controls .group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
|
| 43 |
+
.controls label { font-size: 13px; color: #cbd1dc; }
|
| 44 |
+
.controls textarea { resize: vertical; min-height: 72px; border-radius: 10px; background: #0f1016; color: #e6e6e6; border: 1px solid rgba(255,255,255,0.08); padding: 10px; outline: none; }
|
| 45 |
+
|
| 46 |
+
.controls .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
|
| 47 |
+
.field { display: flex; flex-direction: column; gap: 6px; }
|
| 48 |
+
select, input[type="text"], input[type="range"] { width: 100%; }
|
| 49 |
+
select, input[type="text"] { background: #0f1016; color: #e6e6e6; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 8px 10px; outline: none; }
|
| 50 |
+
input[type="range"] { accent-color: #ff6a00; }
|
| 51 |
+
|
| 52 |
+
.primary { background: linear-gradient(90deg,#ff8a00,#ff4d4d); border: none; color: white; padding: 10px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; }
|
| 53 |
+
.primary:disabled { opacity: .6; cursor: not-allowed; }
|
| 54 |
+
|
| 55 |
+
.disclaimer { font-size: 12px; color: #9aa2af; }
|
| 56 |
+
|
| 57 |
+
.output .toolbar { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
|
| 58 |
+
.tag { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); color: #d7dbe3; padding: 4px 8px; border-radius: 999px; font-size: 12px; }
|
| 59 |
+
.tag.secondary { background: transparent; }
|
| 60 |
+
|
| 61 |
+
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
|
| 62 |
+
.tile { position: relative; overflow: hidden; border-radius: 12px; aspect-ratio: 1/1; background: #0f1016; border: 1px solid rgba(255,255,255,0.06); }
|
| 63 |
+
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
| 64 |
+
|
| 65 |
+
.skeleton { background: linear-gradient(90deg, #0f1016 0%, #141622 50%, #0f1016 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
|
| 66 |
+
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
|
| 67 |
+
|
| 68 |
+
.hf-footer { margin-top: 16px; text-align: center; color: #9aa2af; font-size: 12px; }
|
| 69 |
+
|
| 70 |
+
/* responsive */
|
| 71 |
+
@media (max-width: 900px) {
|
| 72 |
+
.hf-main { grid-template-columns: 1fr; }
|
| 73 |
+
}
|