Spaces:
Running
Running
Update index.html
Browse files- index.html +38 -48
index.html
CHANGED
|
@@ -2,28 +2,31 @@
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<title>AI Storyboard -
|
| 6 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js"></script>
|
| 7 |
<style>
|
| 8 |
:root { --bg: #0f172a; --accent: #8b5cf6; }
|
| 9 |
body { font-family: sans-serif; background: var(--bg); color: white; padding: 20px; text-align: center; }
|
| 10 |
-
.box { max-width:
|
| 11 |
textarea, input { width: 100%; padding: 12px; margin: 10px 0; border-radius: 6px; border: 1px solid #334155; background: #0f172a; color: white; box-sizing: border-box; }
|
| 12 |
button { width: 100%; padding: 15px; background: var(--accent); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 16px; }
|
| 13 |
#status { margin: 15px 0; padding: 10px; border-radius: 6px; display: none; }
|
| 14 |
.loading { background: #1e3a8a; border: 1px solid #3b82f6; }
|
| 15 |
-
.
|
| 16 |
-
.
|
| 17 |
-
.card img { width: 100%; border-radius: 8px;
|
| 18 |
</style>
|
| 19 |
</head>
|
| 20 |
<body>
|
| 21 |
|
| 22 |
<div class="box">
|
| 23 |
-
<h2>🚀 Storyboard
|
|
|
|
|
|
|
| 24 |
<input type="password" id="hfToken" placeholder="Enter WRITE Token (hf_...)">
|
| 25 |
-
<textarea id="
|
| 26 |
-
<button onclick="generate()">
|
|
|
|
| 27 |
<div id="status"></div>
|
| 28 |
<div class="gallery" id="gallery"></div>
|
| 29 |
</div>
|
|
@@ -31,59 +34,46 @@
|
|
| 31 |
<script>
|
| 32 |
async function generate() {
|
| 33 |
const token = document.getElementById('hfToken').value.trim();
|
| 34 |
-
const
|
| 35 |
const status = document.getElementById('status');
|
| 36 |
const gallery = document.getElementById('gallery');
|
| 37 |
|
| 38 |
-
if (!token || !
|
| 39 |
|
| 40 |
-
const scenes = script.split(/Scene \d+ \/ \d+/).filter(s => s.trim().length > 10);
|
| 41 |
status.style.display = "block";
|
| 42 |
status.className = "loading";
|
|
|
|
| 43 |
gallery.innerHTML = "";
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
const
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
"
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
"Content-Type": "application/json"
|
| 58 |
-
},
|
| 59 |
-
body: JSON.stringify({
|
| 60 |
-
inputs: prompt + ", cinematic 3d render, high quality, pixar style",
|
| 61 |
-
options: { wait_for_model: true, use_cache: false }
|
| 62 |
-
})
|
| 63 |
-
}
|
| 64 |
-
);
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
gallery.appendChild(div);
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
status.className = "error";
|
| 82 |
-
status.innerHTML = `<b>Error:</b> ${err.message}<br><small>If it says 'Failed to fetch', try disabling your Browser's Ad-blocker or VPN.</small>`;
|
| 83 |
-
return;
|
| 84 |
-
}
|
| 85 |
}
|
| 86 |
-
status.innerText = "All Scenes Done!";
|
| 87 |
}
|
| 88 |
</script>
|
| 89 |
</body>
|
|
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>AI Storyboard - Proxy Bypass</title>
|
| 6 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js"></script>
|
| 7 |
<style>
|
| 8 |
:root { --bg: #0f172a; --accent: #8b5cf6; }
|
| 9 |
body { font-family: sans-serif; background: var(--bg); color: white; padding: 20px; text-align: center; }
|
| 10 |
+
.box { max-width: 600px; margin: auto; background: #1e293b; padding: 25px; border-radius: 12px; border: 1px solid #334155; }
|
| 11 |
textarea, input { width: 100%; padding: 12px; margin: 10px 0; border-radius: 6px; border: 1px solid #334155; background: #0f172a; color: white; box-sizing: border-box; }
|
| 12 |
button { width: 100%; padding: 15px; background: var(--accent); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 16px; }
|
| 13 |
#status { margin: 15px 0; padding: 10px; border-radius: 6px; display: none; }
|
| 14 |
.loading { background: #1e3a8a; border: 1px solid #3b82f6; }
|
| 15 |
+
.gallery { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 25px; }
|
| 16 |
+
.card { background: #0f172a; padding: 10px; border-radius: 10px; }
|
| 17 |
+
.card img { width: 100%; border-radius: 8px; }
|
| 18 |
</style>
|
| 19 |
</head>
|
| 20 |
<body>
|
| 21 |
|
| 22 |
<div class="box">
|
| 23 |
+
<h2>🚀 Storyboard (Bypass Mode)</h2>
|
| 24 |
+
<p style="font-size: 12px; color: #94a3b8;">Using Proxy to fix 'Failed to Fetch' error</p>
|
| 25 |
+
|
| 26 |
<input type="password" id="hfToken" placeholder="Enter WRITE Token (hf_...)">
|
| 27 |
+
<textarea id="promptInput" rows="4" placeholder="Scene Description..."></textarea>
|
| 28 |
+
<button onclick="generate()">Generate Image</button>
|
| 29 |
+
|
| 30 |
<div id="status"></div>
|
| 31 |
<div class="gallery" id="gallery"></div>
|
| 32 |
</div>
|
|
|
|
| 34 |
<script>
|
| 35 |
async function generate() {
|
| 36 |
const token = document.getElementById('hfToken').value.trim();
|
| 37 |
+
const prompt = document.getElementById('promptInput').value.trim();
|
| 38 |
const status = document.getElementById('status');
|
| 39 |
const gallery = document.getElementById('gallery');
|
| 40 |
|
| 41 |
+
if (!token || !prompt) { alert("Fields are empty!"); return; }
|
| 42 |
|
|
|
|
| 43 |
status.style.display = "block";
|
| 44 |
status.className = "loading";
|
| 45 |
+
status.innerText = "Connecting through Proxy... Please wait.";
|
| 46 |
gallery.innerHTML = "";
|
| 47 |
|
| 48 |
+
try {
|
| 49 |
+
// ہم یہاں براہ راست کال کے بجائے CORS Proxy استعمال کر رہے ہیں
|
| 50 |
+
const proxyUrl = "https://corsproxy.io/?";
|
| 51 |
+
const apiUrl = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-schnell";
|
| 52 |
|
| 53 |
+
const response = await fetch(proxyUrl + encodeURIComponent(apiUrl), {
|
| 54 |
+
method: "POST",
|
| 55 |
+
headers: {
|
| 56 |
+
"Authorization": `Bearer ${token}`,
|
| 57 |
+
"Content-Type": "application/json"
|
| 58 |
+
},
|
| 59 |
+
body: JSON.stringify({ inputs: prompt })
|
| 60 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
if (!response.ok) {
|
| 63 |
+
const err = await response.json();
|
| 64 |
+
throw new Error(err.error || "API Error");
|
| 65 |
+
}
|
| 66 |
|
| 67 |
+
const blob = await response.blob();
|
| 68 |
+
const url = URL.createObjectURL(blob);
|
| 69 |
+
|
| 70 |
+
status.innerText = "Success!";
|
| 71 |
+
gallery.innerHTML = `<div class="card"><img src="${url}"></div>`;
|
|
|
|
| 72 |
|
| 73 |
+
} catch (err) {
|
| 74 |
+
status.style.background = "#7f1d1d";
|
| 75 |
+
status.innerText = "Error: " + err.message;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
}
|
|
|
|
| 77 |
}
|
| 78 |
</script>
|
| 79 |
</body>
|