wmhealt commited on
Commit
bf48ea7
·
verified ·
1 Parent(s): bb1d60f

Update index.html

Browse files
Files changed (1) hide show
  1. 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 - Final 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: 700px; margin: auto; background: #1e293b; padding: 25px; border-radius: 12px; }
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
- .error { background: #7f1d1d; border: 1px solid #ef4444; }
16
- .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; margin-top: 25px; }
17
- .card img { width: 100%; border-radius: 8px; border: 1px solid #475569; }
18
  </style>
19
  </head>
20
  <body>
21
 
22
  <div class="box">
23
- <h2>🚀 Storyboard Pro (Safe Mode)</h2>
 
 
24
  <input type="password" id="hfToken" placeholder="Enter WRITE Token (hf_...)">
25
- <textarea id="scriptInput" rows="5" placeholder="Paste Scene 1 / 50 format..."></textarea>
26
- <button onclick="generate()">Start Generating</button>
 
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 script = document.getElementById('scriptInput').value.trim();
35
  const status = document.getElementById('status');
36
  const gallery = document.getElementById('gallery');
37
 
38
- if (!token || !script) { alert("Please fill all fields!"); return; }
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
- for (let i = 0; i < scenes.length; i++) {
46
- status.innerText = `Generating Scene ${i+1}...`;
47
- const prompt = scenes[i].split("SCENE IMAGE PROMPT:")[1] || scenes[i];
 
48
 
49
- try {
50
- // ہم براہ راست کال کے بجائے یہ نیا طریقہ استعمال کر رہے ہیں
51
- const response = await fetch(
52
- "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-schnell",
53
- {
54
- method: "POST",
55
- headers: {
56
- "Authorization": `Bearer ${token}`,
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
- if (!response.ok) {
67
- const errObj = await response.json();
68
- throw new Error(errObj.error || "Model Error");
69
- }
70
 
71
- const blob = await response.blob();
72
- const url = URL.createObjectURL(blob);
73
- const div = document.createElement('div');
74
- div.className = "card";
75
- div.innerHTML = `<strong>Scene ${i+1}</strong><br><img src="${url}">`;
76
- gallery.appendChild(div);
77
 
78
- } catch (err) {
79
- console.error(err);
80
- // اگر Failed to fetch آئے تو ہم ایک متبادل میسج دکھائیں گے
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>