Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
429 auto-retry: wait in queue instead of erroring
Browse files- index.html +12 -1
index.html
CHANGED
|
@@ -149,6 +149,7 @@ const T={
|
|
| 149 |
n2:"Korean prompts lose count: โa red appleโ gives one in English, five or six in Korean.",
|
| 150 |
n3:"This Space runs on shared CPU hardware, so it is slower than the numbers above.",
|
| 151 |
ft:"We did not train this model. Ours is the CPU packaging, the 3-step setting, the re-quantization, and the measurements.",
|
|
|
|
| 152 |
ex:["a red apple on a wooden table, photorealistic","a misty pine forest at sunrise, cinematic","a calico cat asleep on a windowsill, soft light","a ceramic coffee cup, studio product shot"]},
|
| 153 |
ko:{tag:"CPU๋ง์ผ๋ก ์ด๋ฏธ์ง ์์ฑ. GPU๋ CUDA๋ ํ์ด์ฌ๋ ํ์ ์์ต๋๋ค.",
|
| 154 |
h1:"<b>๊ทธ๋ํฝ์นด๋ ์์ด</b> ์ฌ์ง๊ธ ์ด๋ฏธ์ง๋ฅผ <b>46์ด</b>์.",
|
|
@@ -161,6 +162,7 @@ const T={
|
|
| 161 |
n2:"ํ๊ตญ์ด์์ ๊ฐ์๋ฅผ ํ๋ฆฝ๋๋ค. โ๋นจ๊ฐ ์ฌ๊ณผโ๊ฐ ์์ด๋ก๋ 1๊ฐ, ํ๊ตญ์ด๋ก๋ ๋์ฌ์ฏ ๊ฐ๊ฐ ๋์ต๋๋ค.",
|
| 162 |
n3:"์ด ๋ฐ๋ชจ๋ ๊ณต์ฉ CPU์์ ๋์ ์ ์์น๋ณด๋ค ๋๋ฆฝ๋๋ค.",
|
| 163 |
ft:"์ ํฌ๊ฐ ๋ชจ๋ธ์ ํ์ต์ํจ ๊ฒ ์๋๋๋ค. ์ ํฌ ๊ฒ์ CPU ํจํค์ง, 3์คํ
์ค์ , ์ฌ์์ํ, ๊ทธ๋ฆฌ๊ณ ์ธก์ ๊ฐ์
๋๋ค.",
|
|
|
|
| 164 |
ex:["๋๋ฌด ํ์ ์์ ๋นจ๊ฐ ์ฌ๊ณผ, ์ฌ์ค์ ์ธ ์ฌ์ง","ํด ๋ฐ ๋ฌด๋ ต ์๊ฐ ๋ ์๋๋ฌด ์ฒ, ์ํ์ ์ธ","์ฐฝ๊ฐ์์ ์๋ ์ผ์ ๊ณ ์์ด, ๋ถ๋๋ฌ์ด ๋น","๋์๊ธฐ ์ปคํผ์, ์คํ๋์ค ์ ํ ์ฌ์ง"]},
|
| 165 |
zh:{tag:"ไป
็จ CPU ็ๆๅพๅใๆ ้ GPUใCUDA ๆ Pythonใ",
|
| 166 |
h1:"<b>ๆ ้ๆพๅก</b>๏ผ<b>46 ็ง</b>็ๆ็
ง็็บงๅพๅใ",
|
|
@@ -173,6 +175,7 @@ const T={
|
|
| 173 |
n2:"ไธญๆ/้ฉๆๆ็คบ่ฏไผไธขๅคฑๆฐ้ไฟกๆฏใ",
|
| 174 |
n3:"ๆฌๆผ็คบ่ฟ่กๅจๅ
ฑไบซ CPU ไธ๏ผๆฏไธ่ฟฐๆฐๆฎๆ
ขใ",
|
| 175 |
ft:"ๆไปฌๆฒกๆ่ฎญ็ป่ฏฅๆจกๅใๆไปฌๅ็ๆฏ CPU ๅฐ่ฃ
ใ3 ๆญฅ่ฎพ็ฝฎใ้ๆฐ้ๅไปฅๅ่ฟไบๅฎๆตๆฐๆฎใ",
|
|
|
|
| 176 |
ex:["ๆจๆกไธ็็บข่นๆ๏ผ็
ง็็บง็ๅฎ","ๆฅๅบๆถๅ้พๆฐๅผฅๆผซ็ๆพๆ๏ผ็ตๅฝฑๆ","็ชๅฐไธ็็ก็ไธ่ฑ็ซ๏ผๆๅๅ
็บฟ","้ถ็ทๅๅกๆฏ๏ผๆฃๆไบงๅๅพ"]}
|
| 177 |
};
|
| 178 |
let L="en";
|
|
@@ -214,7 +217,15 @@ document.getElementById("go").onclick=async()=>{
|
|
| 214 |
let w=2; bar.style.width="2%";
|
| 215 |
const tk=setInterval(()=>{w=Math.min(93,w+1.6);bar.style.width=w+"%";},900);
|
| 216 |
try{
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
if(!r.ok){throw new Error((await r.text()).slice(0,180));}
|
| 219 |
const d=await r.json();
|
| 220 |
img.src=d.image; img.style.display="block"; ph.style.display="none";
|
|
|
|
| 149 |
n2:"Korean prompts lose count: โa red appleโ gives one in English, five or six in Korean.",
|
| 150 |
n3:"This Space runs on shared CPU hardware, so it is slower than the numbers above.",
|
| 151 |
ft:"We did not train this model. Ours is the CPU packaging, the 3-step setting, the re-quantization, and the measurements.",
|
| 152 |
+
wait:"Someone else is generating. Waiting for your turnโฆ",
|
| 153 |
ex:["a red apple on a wooden table, photorealistic","a misty pine forest at sunrise, cinematic","a calico cat asleep on a windowsill, soft light","a ceramic coffee cup, studio product shot"]},
|
| 154 |
ko:{tag:"CPU๋ง์ผ๋ก ์ด๋ฏธ์ง ์์ฑ. GPU๋ CUDA๋ ํ์ด์ฌ๋ ํ์ ์์ต๋๋ค.",
|
| 155 |
h1:"<b>๊ทธ๋ํฝ์นด๋ ์์ด</b> ์ฌ์ง๊ธ ์ด๋ฏธ์ง๋ฅผ <b>46์ด</b>์.",
|
|
|
|
| 162 |
n2:"ํ๊ตญ์ด์์ ๊ฐ์๋ฅผ ํ๋ฆฝ๋๋ค. โ๋นจ๊ฐ ์ฌ๊ณผโ๊ฐ ์์ด๋ก๋ 1๊ฐ, ํ๊ตญ์ด๋ก๋ ๋์ฌ์ฏ ๊ฐ๊ฐ ๋์ต๋๋ค.",
|
| 163 |
n3:"์ด ๋ฐ๋ชจ๋ ๊ณต์ฉ CPU์์ ๋์ ์ ์์น๋ณด๋ค ๋๋ฆฝ๋๋ค.",
|
| 164 |
ft:"์ ํฌ๊ฐ ๋ชจ๋ธ์ ํ์ต์ํจ ๊ฒ ์๋๋๋ค. ์ ํฌ ๊ฒ์ CPU ํจํค์ง, 3์คํ
์ค์ , ์ฌ์์ํ, ๊ทธ๋ฆฌ๊ณ ์ธก์ ๊ฐ์
๋๋ค.",
|
| 165 |
+
wait:"๋ค๋ฅธ ๋ถ์ด ์์ฑ ์ค์
๋๋ค. ์ฐจ๋ก๋ฅผ ๊ธฐ๋ค๋ฆฝ๋๋คโฆ",
|
| 166 |
ex:["๋๋ฌด ํ์ ์์ ๋นจ๊ฐ ์ฌ๊ณผ, ์ฌ์ค์ ์ธ ์ฌ์ง","ํด ๋ฐ ๋ฌด๋ ต ์๊ฐ ๋ ์๋๋ฌด ์ฒ, ์ํ์ ์ธ","์ฐฝ๊ฐ์์ ์๋ ์ผ์ ๊ณ ์์ด, ๋ถ๋๋ฌ์ด ๋น","๋์๊ธฐ ์ปคํผ์, ์คํ๋์ค ์ ํ ์ฌ์ง"]},
|
| 167 |
zh:{tag:"ไป
็จ CPU ็ๆๅพๅใๆ ้ GPUใCUDA ๆ Pythonใ",
|
| 168 |
h1:"<b>ๆ ้ๆพๅก</b>๏ผ<b>46 ็ง</b>็ๆ็
ง็็บงๅพๅใ",
|
|
|
|
| 175 |
n2:"ไธญๆ/้ฉๆๆ็คบ่ฏไผไธขๅคฑๆฐ้ไฟกๆฏใ",
|
| 176 |
n3:"ๆฌๆผ็คบ่ฟ่กๅจๅ
ฑไบซ CPU ไธ๏ผๆฏไธ่ฟฐๆฐๆฎๆ
ขใ",
|
| 177 |
ft:"ๆไปฌๆฒกๆ่ฎญ็ป่ฏฅๆจกๅใๆไปฌๅ็ๆฏ CPU ๅฐ่ฃ
ใ3 ๆญฅ่ฎพ็ฝฎใ้ๆฐ้ๅไปฅๅ่ฟไบๅฎๆตๆฐๆฎใ",
|
| 178 |
+
wait:"ๅ
ถไปไบบๆญฃๅจ็ๆใๆญฃๅจ็ญๅพ
ๆจ็ๅๅโฆ",
|
| 179 |
ex:["ๆจๆกไธ็็บข่นๆ๏ผ็
ง็็บง็ๅฎ","ๆฅๅบๆถๅ้พๆฐๅผฅๆผซ็ๆพๆ๏ผ็ตๅฝฑๆ","็ชๅฐไธ็็ก็ไธ่ฑ็ซ๏ผๆๅๅ
็บฟ","้ถ็ทๅๅกๆฏ๏ผๆฃๆไบงๅๅพ"]}
|
| 180 |
};
|
| 181 |
let L="en";
|
|
|
|
| 217 |
let w=2; bar.style.width="2%";
|
| 218 |
const tk=setInterval(()=>{w=Math.min(93,w+1.6);bar.style.width=w+"%";},900);
|
| 219 |
try{
|
| 220 |
+
let r,tries=0;
|
| 221 |
+
while(true){
|
| 222 |
+
r=await fetch("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)});
|
| 223 |
+
if(r.status!==429) break;
|
| 224 |
+
tries++;
|
| 225 |
+
if(tries>40) throw new Error("timeout waiting for a free slot");
|
| 226 |
+
mt.innerHTML=`<span>โณ ${T[L].wait} (${tries})</span>`;
|
| 227 |
+
await new Promise(s=>setTimeout(s,8000));
|
| 228 |
+
}
|
| 229 |
if(!r.ok){throw new Error((await r.text()).slice(0,180));}
|
| 230 |
const d=await r.json();
|
| 231 |
img.src=d.image; img.style.display="block"; ph.style.display="none";
|