Update index.html
Browse files- index.html +14 -18
index.html
CHANGED
|
@@ -283,17 +283,9 @@
|
|
| 283 |
<div class="settings-group"><label>تعداد گام (Steps):</label><input type="number" id="steps_input" value="20" min="4" max="50"></div>
|
| 284 |
<div class="settings-group"><label>سید (Seed) تصادفی=-1:</label><input type="number" id="seed_input" value="-1"></div>
|
| 285 |
|
| 286 |
-
<!-- اصلاح: اضافه شدن مدت زمان در کنار CFG -->
|
| 287 |
<div class="settings-group"><label>مقیاس هدایت (CFG):</label><input type="number" id="cfg_input" value="7.0" step="0.5"></div>
|
| 288 |
-
<
|
| 289 |
-
|
| 290 |
-
<select id="duration_select">
|
| 291 |
-
<option value="unknown" selected>خودکار (پیشفرض)</option>
|
| 292 |
-
<option value="short">کوتاه</option>
|
| 293 |
-
<option value="medium">متوسط</option>
|
| 294 |
-
<option value="long">طولانی</option>
|
| 295 |
-
</select>
|
| 296 |
-
</div>
|
| 297 |
</div>
|
| 298 |
|
| 299 |
<div class="settings-group" style="border-top: 1px solid #e2e8f0; padding-top: 15px; margin-bottom: 10px;">
|
|
@@ -509,10 +501,12 @@
|
|
| 509 |
const store = transaction.objectStore("songs");
|
| 510 |
store.add(newItem);
|
| 511 |
|
|
|
|
| 512 |
const countReq = store.count();
|
| 513 |
countReq.onsuccess = () => {
|
| 514 |
if (countReq.result > 10) store.openCursor().onsuccess = (e) => { if(e.target.result) e.target.result.delete(); };
|
| 515 |
};
|
|
|
|
| 516 |
transaction.oncomplete = () => loadHistory();
|
| 517 |
} catch (error) { console.error("Error saving:", error); }
|
| 518 |
}
|
|
@@ -608,7 +602,7 @@
|
|
| 608 |
|
| 609 |
initDB();
|
| 610 |
|
| 611 |
-
// --- تابع
|
| 612 |
async function uploadAudioFile(file) {
|
| 613 |
const formData = new FormData();
|
| 614 |
formData.append("files", file);
|
|
@@ -619,7 +613,6 @@
|
|
| 619 |
});
|
| 620 |
const data = await response.json();
|
| 621 |
if (data && data.length > 0) {
|
| 622 |
-
// ساخت آبجکت فایل برای گرادیو
|
| 623 |
return {
|
| 624 |
"path": data[0],
|
| 625 |
"url": `${ACE_SPACE_URL}gradio_api/file=${data[0]}`,
|
|
@@ -666,7 +659,7 @@
|
|
| 666 |
idea: ideaInput.value,
|
| 667 |
fingerprint: getFingerprint(),
|
| 668 |
is_premium: userSubscriptionStatus === 'paid',
|
| 669 |
-
is_instrumental: isInstrumental
|
| 670 |
})
|
| 671 |
});
|
| 672 |
|
|
@@ -690,14 +683,17 @@
|
|
| 690 |
const { lyrics, musicPrompt } = data;
|
| 691 |
loaderText.innerText = "در حال ضبط آهنگ در استودیو آلفا...";
|
| 692 |
|
| 693 |
-
// در حالت بیکلام، متن خالی ارسال میشود
|
| 694 |
const finalLyrics = isInstrumental ? "" : lyrics;
|
| 695 |
|
| 696 |
-
// ایندکس
|
| 697 |
-
// ایندکس 3 = مدت زمان (پیشفرض unknown)
|
| 698 |
-
// ایندکس 5 = متن ترانه
|
| 699 |
const payload = [
|
| 700 |
-
getVal('model_select'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 701 |
getNum('steps_input'), getNum('cfg_input'), true, getNum('seed_input'), null, -1,
|
| 702 |
getNum('batch_size'), null, null, 0, -1, "Fill the audio semantic mask based on the given conditions:",
|
| 703 |
1, "text2music", false, 0, 1, 3, "ode", "", "mp3", 0.85,
|
|
|
|
| 283 |
<div class="settings-group"><label>تعداد گام (Steps):</label><input type="number" id="steps_input" value="20" min="4" max="50"></div>
|
| 284 |
<div class="settings-group"><label>سید (Seed) تصادفی=-1:</label><input type="number" id="seed_input" value="-1"></div>
|
| 285 |
|
|
|
|
| 286 |
<div class="settings-group"><label>مقیاس هدایت (CFG):</label><input type="number" id="cfg_input" value="7.0" step="0.5"></div>
|
| 287 |
+
<!-- اضافه شدن انتخاب زمان در کنار CFG -->
|
| 288 |
+
<div class="settings-group"><label>مدت زمان آهنگ:</label><select id="duration_select"><option value="unknown" selected>خودکار (استاندارد)</option><option value="short">کوتاه (حدود ۱ دقیقه)</option><option value="medium">متوسط (حدود ۲ دقیقه)</option><option value="long">طولانی (حدود ۳ دقیقه)</option></select></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
</div>
|
| 290 |
|
| 291 |
<div class="settings-group" style="border-top: 1px solid #e2e8f0; padding-top: 15px; margin-bottom: 10px;">
|
|
|
|
| 501 |
const store = transaction.objectStore("songs");
|
| 502 |
store.add(newItem);
|
| 503 |
|
| 504 |
+
// شرط نگهداری فقط ۱۰ آیتم آخر
|
| 505 |
const countReq = store.count();
|
| 506 |
countReq.onsuccess = () => {
|
| 507 |
if (countReq.result > 10) store.openCursor().onsuccess = (e) => { if(e.target.result) e.target.result.delete(); };
|
| 508 |
};
|
| 509 |
+
|
| 510 |
transaction.oncomplete = () => loadHistory();
|
| 511 |
} catch (error) { console.error("Error saving:", error); }
|
| 512 |
}
|
|
|
|
| 602 |
|
| 603 |
initDB();
|
| 604 |
|
| 605 |
+
// --- تابع آپلود فایل صوتی به Gradio ---
|
| 606 |
async function uploadAudioFile(file) {
|
| 607 |
const formData = new FormData();
|
| 608 |
formData.append("files", file);
|
|
|
|
| 613 |
});
|
| 614 |
const data = await response.json();
|
| 615 |
if (data && data.length > 0) {
|
|
|
|
| 616 |
return {
|
| 617 |
"path": data[0],
|
| 618 |
"url": `${ACE_SPACE_URL}gradio_api/file=${data[0]}`,
|
|
|
|
| 659 |
idea: ideaInput.value,
|
| 660 |
fingerprint: getFingerprint(),
|
| 661 |
is_premium: userSubscriptionStatus === 'paid',
|
| 662 |
+
is_instrumental: isInstrumental
|
| 663 |
})
|
| 664 |
});
|
| 665 |
|
|
|
|
| 683 |
const { lyrics, musicPrompt } = data;
|
| 684 |
loaderText.innerText = "در حال ضبط آهنگ در استودیو آلفا...";
|
| 685 |
|
|
|
|
| 686 |
const finalLyrics = isInstrumental ? "" : lyrics;
|
| 687 |
|
| 688 |
+
// ایندکس 3: مدت زمان آهنگ (قبلا "unknown" بود، الان getVal('duration_select'))
|
|
|
|
|
|
|
| 689 |
const payload = [
|
| 690 |
+
getVal('model_select'),
|
| 691 |
+
"custom",
|
| 692 |
+
uploadedAudioObj,
|
| 693 |
+
getVal('duration_select'), // تغییر: استفاده از مقدار انتخابی زمان
|
| 694 |
+
musicPrompt,
|
| 695 |
+
finalLyrics,
|
| 696 |
+
0, "", "", "unknown",
|
| 697 |
getNum('steps_input'), getNum('cfg_input'), true, getNum('seed_input'), null, -1,
|
| 698 |
getNum('batch_size'), null, null, 0, -1, "Fill the audio semantic mask based on the given conditions:",
|
| 699 |
1, "text2music", false, 0, 1, 3, "ode", "", "mp3", 0.85,
|