Spaces:
Running
Running
Update index.html
Browse files- index.html +42 -48
index.html
CHANGED
@@ -487,11 +487,11 @@
|
|
487 |
stripePubKey: "__HF_STRIPE_PUBLISHABLE_KEY__", // injected at build time
|
488 |
googleClientId: "__HF_OAUTH_CLIENT_ID__", // injected at build time
|
489 |
endpoints: {
|
490 |
-
uploadImages:
|
491 |
-
uploadZip:
|
492 |
trainModel: "__HF_TRAIN_MODEL__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/train",
|
493 |
-
generateVideo:
|
494 |
-
updatePlan:
|
495 |
createCheckoutSession: "__HF_CREATE_CHECKOUT__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/create-checkout-session",
|
496 |
oauthLogin: "__HF_OAUTH_LOGIN__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/auth/google"
|
497 |
}
|
@@ -823,52 +823,46 @@
|
|
823 |
}
|
824 |
|
825 |
async function trainModel() {
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
progressPercent.textContent = `${Math.floor(progress)}%`;
|
855 |
-
|
856 |
-
if (progress === 100) {
|
857 |
-
clearInterval(interval);
|
858 |
-
setTimeout(() => {
|
859 |
-
trainingProgress.classList.add('hidden');
|
860 |
-
showResults();
|
861 |
-
}, 500);
|
862 |
-
}
|
863 |
}, 500);
|
864 |
-
|
865 |
-
} catch (err) {
|
866 |
-
console.error('Training error:', err);
|
867 |
-
showToast('Training failed. Please try again.');
|
868 |
-
trainingProgress.classList.add('hidden');
|
869 |
-
trainModelSection.classList.remove('hidden');
|
870 |
}
|
871 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
|
873 |
function showResults() {
|
874 |
resultsSection.classList.remove('hidden');
|
|
|
487 |
stripePubKey: "__HF_STRIPE_PUBLISHABLE_KEY__", // injected at build time
|
488 |
googleClientId: "__HF_OAUTH_CLIENT_ID__", // injected at build time
|
489 |
endpoints: {
|
490 |
+
uploadImages: "https://rahul7star-ohamlab-ai-toolkit.hf.space/upload",
|
491 |
+
uploadZip: "https://rahul7star-ohamlab-ai-toolkit.hf.space/upload-zip",
|
492 |
trainModel: "__HF_TRAIN_MODEL__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/train",
|
493 |
+
generateVideo: "https://rahul7star-ohamlab-ai-toolkit.hf.space/generate-video",
|
494 |
+
updatePlan: "https://rahul7star-ohamlab-ai-toolkit.hf.space/update-plan",
|
495 |
createCheckoutSession: "__HF_CREATE_CHECKOUT__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/create-checkout-session",
|
496 |
oauthLogin: "__HF_OAUTH_LOGIN__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/auth/google"
|
497 |
}
|
|
|
823 |
}
|
824 |
|
825 |
async function trainModel() {
|
826 |
+
// Show training progress
|
827 |
+
trainingProgress.classList.remove('hidden');
|
828 |
+
trainModelSection.classList.add('hidden');
|
829 |
+
|
830 |
+
try {
|
831 |
+
|
832 |
+
|
833 |
+
const data = "test"
|
834 |
+
console.log('Training started:', data);
|
835 |
+
|
836 |
+
let progress = 0;
|
837 |
+
const targetDuration = 30 * 60 * 1000; // 30 minutes in milliseconds
|
838 |
+
const intervalDuration = 2000; // Update every 2 seconds
|
839 |
+
const totalTicks = targetDuration / intervalDuration;
|
840 |
+
const incrementPerTick = 100 / totalTicks;
|
841 |
+
|
842 |
+
const interval = setInterval(() => {
|
843 |
+
progress += incrementPerTick;
|
844 |
+
if (progress >= 100) progress = 100;
|
845 |
+
|
846 |
+
progressBar.style.width = `${progress}%`;
|
847 |
+
progressPercent.textContent = `${Math.floor(progress)}%`;
|
848 |
+
|
849 |
+
if (progress === 100) {
|
850 |
+
clearInterval(interval);
|
851 |
+
setTimeout(() => {
|
852 |
+
trainingProgress.classList.add('hidden');
|
853 |
+
showResults();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
854 |
}, 500);
|
|
|
|
|
|
|
|
|
|
|
|
|
855 |
}
|
856 |
+
}, intervalDuration);
|
857 |
+
|
858 |
+
} catch (err) {
|
859 |
+
console.error('Training error:', err);
|
860 |
+
showToast('Training failed. Please try again.');
|
861 |
+
trainingProgress.classList.add('hidden');
|
862 |
+
trainModelSection.classList.remove('hidden');
|
863 |
+
}
|
864 |
+
}
|
865 |
+
|
866 |
|
867 |
function showResults() {
|
868 |
resultsSection.classList.remove('hidden');
|