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| 47 |
-
|
| 48 |
-
<gradio-file name="lion.jpg" url="https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/test_data/lion.jpg" />
|
| 49 |
-
<gradio-file name="logo.png" url="https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png" />
|
| 50 |
-
|
| 51 |
-
<gradio-requirements>
|
| 52 |
-
# Same syntax as requirements.txt
|
| 53 |
-
scikit-image
|
| 54 |
-
</gradio-requirements>
|
| 55 |
-
</gradio-lite>
|
| 56 |
-
</body>
|
| 57 |
-
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Wavetype Frequency Grid - Pro</title>
|
| 7 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
|
| 8 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.1/font/bootstrap-icons.min.css" rel="stylesheet">
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--border-html: #ff0000;
|
| 12 |
+
--border-python: #0000ff;
|
| 13 |
+
--border-image: #00ff00;
|
| 14 |
+
--border-video: #800080;
|
| 15 |
+
--border-3d: #ffa500;
|
| 16 |
+
--border-txt: #808080;
|
| 17 |
+
--border-url: #00ffff;
|
| 18 |
+
--bg-shade: 0.1;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
body, html {
|
| 22 |
+
margin: 0; padding: 0; width: 100%; height: 100vh;
|
| 23 |
+
overflow: hidden; background-color: #000;
|
| 24 |
+
font-family: "Courier New", Courier, monospace; color: white;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
#sidebar {
|
| 28 |
+
position: fixed; left: 0; top: 0; width: 320px; height: 100vh;
|
| 29 |
+
background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
|
| 30 |
+
border-right: 2px solid #333; z-index: 2000;
|
| 31 |
+
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 32 |
+
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5); overflow-y: auto;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
#sidebar.collapsed { transform: translateX(-320px); }
|
| 36 |
+
|
| 37 |
+
#sidebar-toggle {
|
| 38 |
+
position: fixed; left: 320px; top: 20px; width: 40px; height: 40px;
|
| 39 |
+
background: #1a1a1a; border: 2px solid #333; border-left: none;
|
| 40 |
+
border-radius: 0 8px 8px 0; cursor: pointer; z-index: 2001;
|
| 41 |
+
display: flex; align-items: center; justify-content: center; color: white;
|
| 42 |
+
transition: all 0.3s;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
#sidebar.collapsed ~ #sidebar-toggle { left: 0; }
|
| 46 |
+
|
| 47 |
+
.auth-section { padding: 15px; border-bottom: 1px solid #333; background: #111; }
|
| 48 |
+
|
| 49 |
+
.social-btn {
|
| 50 |
+
width: 100%; margin-top: 8px; font-size: 12px; display: flex;
|
| 51 |
+
align-items: center; justify-content: center; gap: 10px;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
#grid-container {
|
| 55 |
+
display: grid; width: 100vw; height: 100vh; gap: 4px; padding: 4px;
|
| 56 |
+
padding-left: 324px; transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
#sidebar.collapsed ~ #grid-container { padding-left: 4px; }
|
| 60 |
+
|
| 61 |
+
.block {
|
| 62 |
+
position: relative; background-color: rgba(255, 255, 255, var(--bg-shade));
|
| 63 |
+
border: 2px solid #333; display: flex; flex-direction: column;
|
| 64 |
+
align-items: center; justify-content: center; cursor: pointer;
|
| 65 |
+
overflow: hidden; animation: liquidPop 0.8s forwards;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
@keyframes liquidPop {
|
| 69 |
+
0% { opacity: 0; transform: scale(0.8); }
|
| 70 |
+
100% { opacity: 1; transform: scale(1); }
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.type-html { border-color: var(--border-html); }
|
| 74 |
+
.type-python { border-color: var(--border-python); }
|
| 75 |
+
.type-image { border-color: var(--border-image); }
|
| 76 |
+
.type-video { border-color: var(--border-video); }
|
| 77 |
+
.type-3d { border-color: var(--border-3d); }
|
| 78 |
+
.type-txt { border-color: var(--border-txt); }
|
| 79 |
+
.type-url { border-color: var(--border-url); }
|
| 80 |
+
|
| 81 |
+
.block.active {
|
| 82 |
+
position: fixed; top: 0; left: 0; width: 100vw !important;
|
| 83 |
+
height: 100vh !important; z-index: 2500; background: #000; padding: 20px;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.close-btn {
|
| 87 |
+
display: none; position: absolute; top: 20px; right: 20px;
|
| 88 |
+
background: #dc3545; color: white; border: none; padding: 8px 16px;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
.block.active .close-btn { display: block; }
|
| 92 |
+
|
| 93 |
+
.preview-content { max-width: 90%; max-height: 80%; display: none; }
|
| 94 |
+
.block.active .preview-content { display: block; }
|
| 95 |
+
|
| 96 |
+
.type-selector-overlay {
|
| 97 |
+
position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
|
| 98 |
+
background: rgba(0,0,0,0.9); z-index: 3000; display: none;
|
| 99 |
+
align-items: center; justify-content: center;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.type-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
|
| 103 |
+
|
| 104 |
+
.type-option {
|
| 105 |
+
width: 80px; height: 80px; border: 2px solid #444; border-radius: 8px;
|
| 106 |
+
display: flex; flex-direction: column; align-items: center;
|
| 107 |
+
justify-content: center; cursor: pointer; font-size: 10px;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.add-block-btn {
|
| 111 |
+
position: absolute; bottom: 5px; right: 5px; width: 24px; height: 24px;
|
| 112 |
+
background: #00ff00; border-radius: 50%; color: #000; border: none; font-weight: bold;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
.python-console {
|
| 116 |
+
width: 100%; height: 60%; background: #000; color: #0f0;
|
| 117 |
+
font-family: monospace; padding: 10px; border: 1px solid #333;
|
| 118 |
+
overflow-y: auto; display: none; margin-top: 10px;
|
| 119 |
+
}
|
| 120 |
+
.block.active .python-console { display: block; }
|
| 121 |
+
</style>
|
| 122 |
+
</head>
|
| 123 |
+
<body>
|
| 124 |
+
|
| 125 |
+
<div id="sidebar">
|
| 126 |
+
<div class="auth-section">
|
| 127 |
+
<div id="user-profile" style="display: none;">
|
| 128 |
+
<p class="small mb-2">Welcome, <span id="user-name" class="fw-bold">User</span></p>
|
| 129 |
+
<button class="btn btn-outline-danger btn-sm w-100" onclick="handleLogout()">Sign Out</button>
|
| 130 |
+
</div>
|
| 131 |
+
<div id="login-section">
|
| 132 |
+
<p class="small text-muted mb-2">Sign in to save layouts</p>
|
| 133 |
+
<button class="btn btn-light social-btn" onclick="handleLogin('Google')">
|
| 134 |
+
<i class="bi bi-google"></i> Google
|
| 135 |
+
</button>
|
| 136 |
+
<button class="btn btn-primary social-btn" onclick="handleLogin('GitHub')">
|
| 137 |
+
<i class="bi bi-github"></i> GitHub
|
| 138 |
+
</button>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
|
| 142 |
+
<div class="p-3">
|
| 143 |
+
<div class="mb-4">
|
| 144 |
+
<label class="form-label small">GRID DENSITY</label>
|
| 145 |
+
<input type="range" class="form-range" id="blockSlider" min="1" max="64" value="4" oninput="updateGrid()">
|
| 146 |
+
<div class="d-flex justify-content-between small">
|
| 147 |
+
<span id="countVal">4</span> Blocks
|
| 148 |
+
<span id="saveIcon" style="display:none; color:#0f0;">Saved!</span>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
<div class="mb-4">
|
| 152 |
+
<label class="form-label small">BACKGROUND SHADE</label>
|
| 153 |
+
<input type="range" class="form-range" id="shadeRange" min="0" max="0.5" step="0.05" value="0.1" oninput="updateShade()">
|
| 154 |
+
</div>
|
| 155 |
+
<button class="btn btn-success btn-sm w-100 mb-2" onclick="saveToCache()">MANUAL SAVE</button>
|
| 156 |
+
<button class="btn btn-outline-secondary btn-sm w-100" onclick="clearGrid()">RESET ALL</button>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
|
| 160 |
+
<button id="sidebar-toggle" onclick="toggleSidebar()">
|
| 161 |
+
<i class="bi bi-chevron-left"></i>
|
| 162 |
+
</button>
|
| 163 |
+
|
| 164 |
+
<div class="type-selector-overlay" id="typeSelectorOverlay">
|
| 165 |
+
<div class="bg-dark p-4 rounded border border-secondary text-center">
|
| 166 |
+
<h6>SELECT MODULE TYPE</h6>
|
| 167 |
+
<div class="type-options">
|
| 168 |
+
<div class="type-option" onclick="addNewBlock('html')"><i class="bi bi-code"></i>HTML</div>
|
| 169 |
+
<div class="type-option" onclick="addNewBlock('python')"><i class="bi bi-terminal"></i>PY</div>
|
| 170 |
+
<div class="type-option" onclick="addNewBlock('image')"><i class="bi bi-image"></i>IMG</div>
|
| 171 |
+
<div class="type-option" onclick="addNewBlock('video')"><i class="bi bi-play-circle"></i>VID</div>
|
| 172 |
+
<div class="type-option" onclick="addNewBlock('url')"><i class="bi bi-globe"></i>URL</div>
|
| 173 |
+
</div>
|
| 174 |
+
<button class="btn btn-sm btn-link text-danger mt-3" onclick="closeTypeSelector()">CANCEL</button>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<div id="grid-container"></div>
|
| 179 |
+
|
| 180 |
+
<script src="https://cdn.jsdelivr.net/pyodide/v0.27.3/full/pyodide.js"></script>
|
| 181 |
+
<script>
|
| 182 |
+
const container = document.getElementById("grid-container");
|
| 183 |
+
const countDisplay = document.getElementById("countVal");
|
| 184 |
+
const contentTypes = ["html", "python", "image", "video", "url"];
|
| 185 |
+
let blocks = [];
|
| 186 |
+
let currentUser = null;
|
| 187 |
+
let pyodide = null;
|
| 188 |
+
|
| 189 |
+
async function initPython() {
|
| 190 |
+
if (!pyodide) {
|
| 191 |
+
pyodide = await loadPyodide();
|
| 192 |
+
await pyodide.loadPackage("micropip");
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
function handleLogin(provider) {
|
| 197 |
+
currentUser = { name: provider + " User", id: Date.now() };
|
| 198 |
+
document.getElementById("login-section").style.display = "none";
|
| 199 |
+
document.getElementById("user-profile").style.display = "block";
|
| 200 |
+
document.getElementById("user-name").innerText = currentUser.name;
|
| 201 |
+
saveToCache();
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
function handleLogout() {
|
| 205 |
+
currentUser = null;
|
| 206 |
+
document.getElementById("login-section").style.display = "block";
|
| 207 |
+
document.getElementById("user-profile").style.display = "none";
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
function saveToCache() {
|
| 211 |
+
const data = { blocks, shade: document.getElementById("shadeRange").value, user: currentUser };
|
| 212 |
+
localStorage.setItem("wave_grid_cache", JSON.stringify(data));
|
| 213 |
+
document.getElementById("saveIcon").style.display = "inline";
|
| 214 |
+
setTimeout(() => { document.getElementById("saveIcon").style.display = "none"; }, 1500);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
function loadFromCache() {
|
| 218 |
+
const cache = localStorage.getItem("wave_grid_cache");
|
| 219 |
+
if (cache) {
|
| 220 |
+
const data = JSON.parse(cache);
|
| 221 |
+
blocks = data.blocks;
|
| 222 |
+
document.getElementById("shadeRange").value = data.shade;
|
| 223 |
+
if (data.user) handleLogin(data.user.name.split(' ')[0]);
|
| 224 |
+
renderGrid();
|
| 225 |
+
} else {
|
| 226 |
+
updateGrid();
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
function toggleSidebar() { document.getElementById("sidebar").classList.toggle("collapsed"); }
|
| 231 |
+
function openTypeSelector() { document.getElementById("typeSelectorOverlay").style.display = "flex"; }
|
| 232 |
+
function closeTypeSelector() { document.getElementById("typeSelectorOverlay").style.display = "none"; }
|
| 233 |
+
|
| 234 |
+
function updateGrid() {
|
| 235 |
+
const count = parseInt(document.getElementById("blockSlider").value);
|
| 236 |
+
countDisplay.innerText = count;
|
| 237 |
+
while (blocks.length < count) {
|
| 238 |
+
blocks.push({ id: Date.now() + Math.random(), type: contentTypes[Math.floor(Math.random() * contentTypes.length)], data: "" });
|
| 239 |
+
}
|
| 240 |
+
while (blocks.length > count) blocks.pop();
|
| 241 |
+
renderGrid();
|
| 242 |
+
saveToCache();
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
function addNewBlock(type) {
|
| 246 |
+
blocks.push({ id: Date.now(), type, data: "" });
|
| 247 |
+
closeTypeSelector();
|
| 248 |
+
renderGrid();
|
| 249 |
+
saveToCache();
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
function renderGrid() {
|
| 253 |
+
const cols = Math.ceil(Math.sqrt(blocks.length)) || 1;
|
| 254 |
+
container.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;
|
| 255 |
+
container.innerHTML = "";
|
| 256 |
+
blocks.forEach((b, i) => {
|
| 257 |
+
const el = document.createElement("div");
|
| 258 |
+
el.className = `block type-${b.type}`;
|
| 259 |
+
el.onclick = () => { if(!el.classList.contains('active')) el.classList.add('active'); };
|
| 260 |
+
|
| 261 |
+
let content = `<span class="small fw-bold opacity-50">${b.type.toUpperCase()}</span>`;
|
| 262 |
+
if(b.type === 'python') {
|
| 263 |
+
content += `<textarea class="form-control form-control-sm m-2 w-75 bg-dark text-white" style="display:none" placeholder="print('hello')"></textarea>
|
| 264 |
+
<button class="btn btn-sm btn-primary m-1" style="display:none" onclick="runPython(${i}, this)">RUN</button>
|
| 265 |
+
<div class="python-console" id="console-${i}">Ready...</div>`;
|
| 266 |
}
|
| 267 |
+
content += `<button class="close-btn" onclick="event.stopPropagation(); this.parentElement.classList.remove('active')">EXIT</button>
|
| 268 |
+
<button class="add-block-btn" onclick="event.stopPropagation(); openTypeSelector()">+</button>`;
|
| 269 |
+
el.innerHTML = content;
|
| 270 |
+
container.appendChild(el);
|
| 271 |
+
});
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
async function runPython(index, btn) {
|
| 275 |
+
event.stopPropagation();
|
| 276 |
+
const code = btn.previousElementSibling.value;
|
| 277 |
+
const consoleEl = document.getElementById(`console-${index}`);
|
| 278 |
+
consoleEl.innerText = "Executing...";
|
| 279 |
+
try {
|
| 280 |
+
await initPython();
|
| 281 |
+
let result = await pyodide.runPythonAsync(code);
|
| 282 |
+
consoleEl.innerText = result || "Success (no output)";
|
| 283 |
+
} catch (err) {
|
| 284 |
+
consoleEl.innerText = "Error: " + err.message;
|
| 285 |
+
}
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
window.onload = loadFromCache;
|
| 289 |
+
</script>
|
| 290 |
+
</body>
|
| 291 |
+
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|