rahul7star commited on
Commit
8844b2d
·
verified ·
1 Parent(s): 839a84f

Update index.html

Browse files
Files changed (1) hide show
  1. 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: "__HF_UPLOAD_IMAGES__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/upload",
491
- uploadZip: "__HF_UPLOAD_ZIP__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/upload-zip",
492
  trainModel: "__HF_TRAIN_MODEL__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/train",
493
- generateVideo: "__HF_GENERATE_VIDEO__" || "https://rahul7star-ohamlab-ai-toolkit.hf.space/generate-video",
494
- updatePlan: "__HF_UPDATE_PLAN__" || "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,52 +823,46 @@
823
  }
824
 
825
  async function trainModel() {
826
- // Show training progress
827
- trainingProgress.classList.remove('hidden');
828
- trainModelSection.classList.add('hidden');
829
-
830
- // Mock API call
831
- try {
832
- const res = await fetch(CONFIG.endpoints.trainModel, {
833
- method: "POST",
834
- headers: {
835
- 'Content-Type': 'application/json'
836
- },
837
- body: JSON.stringify({
838
- imageCount: selectedImages.length
839
- })
840
- });
841
-
842
- if (!res.ok) throw new Error('Training failed');
843
-
844
- // Simulate training progress with real API response
845
- const data = await res.json();
846
- console.log('Training started:', data);
847
-
848
- let progress = 0;
849
- const interval = setInterval(() => {
850
- progress += Math.random() * 10;
851
- if (progress > 100) progress = 100;
852
-
853
- progressBar.style.width = `${progress}%`;
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');