rahul7star commited on
Commit
c81b265
·
verified ·
1 Parent(s): 1872782

fix API Type - Post
URL - “https://rahul7star-ohamlab-uploader.hf.space/upload"
 Upload Zip
Api type - POST
URL fetch("https://rahul7star-ohamlab-uploader.hf.space/upload-zip" - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +157 -57
index.html CHANGED
@@ -8,7 +8,7 @@
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
10
  .gradient-bg {
11
- background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
12
  }
13
  .upload-area {
14
  border: 2px dashed #cbd5e0;
@@ -48,13 +48,13 @@
48
  }
49
  </style>
50
  </head>
51
- <body class="gradient-bg min-h-screen">
52
  <!-- Navigation Bar -->
53
- <nav class="bg-white shadow-sm sticky top-0 z-10">
54
  <div class="container mx-auto px-4 py-3 flex justify-between items-center">
55
  <div class="flex items-center">
56
- <i class="fas fa-robot text-indigo-600 text-2xl mr-2"></i>
57
- <span class="text-xl font-bold text-gray-800">OhamLab</span>
58
  </div>
59
  <div class="hidden md:flex space-x-8">
60
  <a href="#home" class="nav-link text-gray-700 hover:text-indigo-600 font-medium">Home</a>
@@ -94,10 +94,10 @@
94
  <main class="max-w-4xl mx-auto">
95
  <!-- Home Section -->
96
  <section id="home" class="text-center py-16">
97
- <h1 class="text-4xl font-bold text-gray-800 mb-4">OhamLab - Create Your Digital Twin</h1>
98
- <p class="text-xl text-gray-600 mb-8">Generate AI-powered avatars that look just like you</p>
99
  <div class="flex space-x-4 justify-center">
100
- <button id="get-started-btn" class="bg-gradient-to-r from-indigo-500 to-purple-600 text-white px-8 py-3 rounded-full font-medium shadow-lg hover:opacity-90 transition">
101
  Get Started
102
  </button>
103
  <button id="demo-btn" class="bg-white text-indigo-600 border-2 border-indigo-600 px-8 py-3 rounded-full font-medium shadow-lg hover:bg-indigo-50 transition">
@@ -110,8 +110,8 @@
110
  <section id="features" class="mb-16">
111
  <h2 class="text-2xl font-bold text-gray-800 mb-8 text-center">Key Features</h2>
112
  <div class="grid md:grid-cols-3 gap-8">
113
- <div class="bg-white p-6 rounded-xl shadow-md">
114
- <div class="text-indigo-500 text-3xl mb-4">
115
  <i class="fas fa-user-circle"></i>
116
  </div>
117
  <h3 class="text-lg font-semibold mb-2">Realistic Avatars</h3>
@@ -135,7 +135,7 @@
135
  </section>
136
 
137
  <!-- Upload Section -->
138
- <section id="create" class="mb-12 bg-white rounded-xl shadow-lg p-6 hidden">
139
  <h2 class="text-xl font-semibold text-gray-800 mb-6">Create Your AI Clone</h2>
140
 
141
  <div class="grid md:grid-cols-2 gap-6">
@@ -261,7 +261,7 @@
261
  </section>
262
 
263
  <!-- Pricing Plans -->
264
- <section id="pricing" class="mb-12 bg-white rounded-xl shadow-lg p-6">
265
  <h2 class="text-xl font-semibold text-gray-800 mb-6">Choose Your Plan</h2>
266
 
267
  <div class="grid md:grid-cols-3 gap-6">
@@ -382,7 +382,7 @@
382
  </main>
383
 
384
  <!-- Footer -->
385
- <footer class="mt-12 bg-white py-8 border-t border-gray-200">
386
  <div class="container mx-auto px-4 text-center text-gray-600">
387
  <p>© 2025 OhamLab. All rights reserved.</p>
388
  <div class="flex justify-center space-x-4 mt-4">
@@ -554,7 +554,7 @@
554
  });
555
  }
556
 
557
- function handleImageUpload(e) {
558
  const files = Array.from(e.target.files);
559
 
560
  if (files.length < 5) {
@@ -567,13 +567,49 @@
567
 
568
  // Show the train model button if we have enough images
569
  trainModelSection.classList.remove('hidden');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  }
571
 
572
- function handleZipUpload(e) {
573
  if (e.target.files.length > 0) {
574
- // Show the train model button when ZIP is uploaded
575
- trainModelSection.classList.remove('hidden');
576
- showToast("ZIP file uploaded successfully!");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  }
578
  }
579
 
@@ -608,28 +644,52 @@
608
  trainModelSection.classList.add('hidden');
609
  }
610
 
611
- function trainModel() {
612
  // Show training progress
613
  trainingProgress.classList.remove('hidden');
614
  trainModelSection.classList.add('hidden');
615
 
616
- // Simulate training progress
617
- let progress = 0;
618
- const interval = setInterval(() => {
619
- progress += Math.random() * 10;
620
- if (progress > 100) progress = 100;
 
 
 
 
 
 
621
 
622
- progressBar.style.width = `${progress}%`;
623
- progressPercent.textContent = `${Math.floor(progress)}%`;
624
 
625
- if (progress === 100) {
626
- clearInterval(interval);
627
- setTimeout(() => {
628
- trainingProgress.classList.add('hidden');
629
- showResults();
630
- }, 500);
631
- }
632
- }, 500);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
633
  }
634
 
635
  function showResults() {
@@ -657,7 +717,7 @@
657
  }, 800);
658
  }
659
 
660
- function generateVideo() {
661
  if (!promptInput.value.trim()) {
662
  showToast("Please enter a prompt first");
663
  return;
@@ -666,35 +726,75 @@
666
  videoLoading.classList.remove('hidden');
667
  videoPreview.classList.add('hidden');
668
 
669
- // Simulate video generation
670
- setTimeout(() => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
  videoLoading.classList.add('hidden');
672
  videoPreview.classList.remove('hidden');
673
  showToast("Video generated successfully!");
674
- }, 3000);
 
 
 
 
 
675
  }
676
 
677
- function selectPlan(plan) {
678
  selectedPlan = plan;
679
 
680
- // Update UI
681
- planCards.forEach(card => {
682
- if (card.dataset.plan === plan) {
683
- card.classList.add('selected-plan');
684
- card.querySelector('button').classList.add('bg-indigo-600', 'text-white');
685
- card.querySelector('button').classList.remove('border-gray-300', 'text-gray-700');
686
- } else {
687
- card.classList.remove('selected-plan');
688
- card.querySelector('button').classList.remove('bg-indigo-600', 'text-white');
689
- card.querySelector('button').classList.add('border-gray-300', 'text-gray-700');
690
- }
691
- });
692
-
693
- // Show confirmation
694
- planConfirmation.classList.remove('hidden');
695
- setTimeout(() => {
696
- planConfirmation.classList.add('hidden');
697
- }, 3000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
698
  }
699
 
700
  function showToast(message) {
 
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
10
  .gradient-bg {
11
+ background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
12
  }
13
  .upload-area {
14
  border: 2px dashed #cbd5e0;
 
48
  }
49
  </style>
50
  </head>
51
+ <body class="min-h-screen">
52
  <!-- Navigation Bar -->
53
+ <nav class="bg-gray-900 shadow-sm sticky top-0 z-10 border-b border-purple-500">
54
  <div class="container mx-auto px-4 py-3 flex justify-between items-center">
55
  <div class="flex items-center">
56
+ <i class="fas fa-robot text-purple-400 text-2xl mr-2"></i>
57
+ <span class="text-xl font-bold text-purple-200">OhamLab</span>
58
  </div>
59
  <div class="hidden md:flex space-x-8">
60
  <a href="#home" class="nav-link text-gray-700 hover:text-indigo-600 font-medium">Home</a>
 
94
  <main class="max-w-4xl mx-auto">
95
  <!-- Home Section -->
96
  <section id="home" class="text-center py-16">
97
+ <h1 class="text-4xl font-bold text-purple-200 mb-4">OhamLab - Create Your Digital Twin</h1>
98
+ <p class="text-xl text-purple-300 mb-8">Generate AI-powered avatars that look just like you</p>
99
  <div class="flex space-x-4 justify-center">
100
+ <button id="get-started-btn" class="bg-gradient-to-r from-purple-500 to-pink-600 text-white px-8 py-3 rounded-full font-medium shadow-lg hover:opacity-90 transition">
101
  Get Started
102
  </button>
103
  <button id="demo-btn" class="bg-white text-indigo-600 border-2 border-indigo-600 px-8 py-3 rounded-full font-medium shadow-lg hover:bg-indigo-50 transition">
 
110
  <section id="features" class="mb-16">
111
  <h2 class="text-2xl font-bold text-gray-800 mb-8 text-center">Key Features</h2>
112
  <div class="grid md:grid-cols-3 gap-8">
113
+ <div class="bg-gray-800 p-6 rounded-xl shadow-md border border-purple-500">
114
+ <div class="text-purple-400 text-3xl mb-4 neon-glow">
115
  <i class="fas fa-user-circle"></i>
116
  </div>
117
  <h3 class="text-lg font-semibold mb-2">Realistic Avatars</h3>
 
135
  </section>
136
 
137
  <!-- Upload Section -->
138
+ <section id="create" class="mb-12 bg-gray-800 rounded-xl shadow-lg p-6 hidden border border-purple-500">
139
  <h2 class="text-xl font-semibold text-gray-800 mb-6">Create Your AI Clone</h2>
140
 
141
  <div class="grid md:grid-cols-2 gap-6">
 
261
  </section>
262
 
263
  <!-- Pricing Plans -->
264
+ <section id="pricing" class="mb-12 bg-gray-800 rounded-xl shadow-lg p-6 border border-purple-500">
265
  <h2 class="text-xl font-semibold text-gray-800 mb-6">Choose Your Plan</h2>
266
 
267
  <div class="grid md:grid-cols-3 gap-6">
 
382
  </main>
383
 
384
  <!-- Footer -->
385
+ <footer class="mt-12 bg-gray-900 py-8 border-t border-purple-500">
386
  <div class="container mx-auto px-4 text-center text-gray-600">
387
  <p>© 2025 OhamLab. All rights reserved.</p>
388
  <div class="flex justify-center space-x-4 mt-4">
 
554
  });
555
  }
556
 
557
+ async function handleImageUpload(e) {
558
  const files = Array.from(e.target.files);
559
 
560
  if (files.length < 5) {
 
567
 
568
  // Show the train model button if we have enough images
569
  trainModelSection.classList.remove('hidden');
570
+
571
+ // Mock API call when images are ready
572
+ try {
573
+ const formData = new FormData();
574
+ selectedImages.forEach(file => formData.append('files', file));
575
+
576
+ const res = await fetch("https://rahul7star-ohamlab-uploader.hf.space/upload", {
577
+ method: "POST",
578
+ body: formData,
579
+ // Do NOT set Content-Type here! Let browser handle it
580
+ });
581
+
582
+ if (!res.ok) throw new Error('Upload failed');
583
+ const data = await res.json();
584
+ console.log('Upload successful:', data);
585
+ showToast('Images uploaded successfully!');
586
+ } catch (err) {
587
+ console.error('Upload error:', err);
588
+ showToast('Upload failed. Please try again.');
589
+ }
590
  }
591
 
592
+ async function handleZipUpload(e) {
593
  if (e.target.files.length > 0) {
594
+ try {
595
+ const formData = new FormData();
596
+ formData.append('zip', e.target.files[0]);
597
+
598
+ const res = await fetch("https://rahul7star-ohamlab-uploader.hf.space/upload-zip", {
599
+ method: "POST",
600
+ body: formData,
601
+ // Do NOT set Content-Type here! Let browser handle it
602
+ });
603
+
604
+ if (!res.ok) throw new Error('ZIP upload failed');
605
+
606
+ // Show the train model button when ZIP is uploaded
607
+ trainModelSection.classList.remove('hidden');
608
+ showToast("ZIP file uploaded successfully!");
609
+ } catch (err) {
610
+ console.error('ZIP upload error:', err);
611
+ showToast('ZIP upload failed. Please try again.');
612
+ }
613
  }
614
  }
615
 
 
644
  trainModelSection.classList.add('hidden');
645
  }
646
 
647
+ async function trainModel() {
648
  // Show training progress
649
  trainingProgress.classList.remove('hidden');
650
  trainModelSection.classList.add('hidden');
651
 
652
+ // Mock API call
653
+ try {
654
+ const res = await fetch("https://rahul7star-ohamlab-uploader.hf.space/train", {
655
+ method: "POST",
656
+ headers: {
657
+ 'Content-Type': 'application/json'
658
+ },
659
+ body: JSON.stringify({
660
+ imageCount: selectedImages.length
661
+ })
662
+ });
663
 
664
+ if (!res.ok) throw new Error('Training failed');
 
665
 
666
+ // Simulate training progress with real API response
667
+ const data = await res.json();
668
+ console.log('Training started:', data);
669
+
670
+ let progress = 0;
671
+ const interval = setInterval(() => {
672
+ progress += Math.random() * 10;
673
+ if (progress > 100) progress = 100;
674
+
675
+ progressBar.style.width = `${progress}%`;
676
+ progressPercent.textContent = `${Math.floor(progress)}%`;
677
+
678
+ if (progress === 100) {
679
+ clearInterval(interval);
680
+ setTimeout(() => {
681
+ trainingProgress.classList.add('hidden');
682
+ showResults();
683
+ }, 500);
684
+ }
685
+ }, 500);
686
+
687
+ } catch (err) {
688
+ console.error('Training error:', err);
689
+ showToast('Training failed. Please try again.');
690
+ trainingProgress.classList.add('hidden');
691
+ trainModelSection.classList.remove('hidden');
692
+ }
693
  }
694
 
695
  function showResults() {
 
717
  }, 800);
718
  }
719
 
720
+ async function generateVideo() {
721
  if (!promptInput.value.trim()) {
722
  showToast("Please enter a prompt first");
723
  return;
 
726
  videoLoading.classList.remove('hidden');
727
  videoPreview.classList.add('hidden');
728
 
729
+ // Mock API call
730
+ try {
731
+ const res = await fetch("https://rahul7star-ohamlab-uploader.hf.space/generate-video", {
732
+ method: "POST",
733
+ headers: {
734
+ 'Content-Type': 'application/json'
735
+ },
736
+ body: JSON.stringify({
737
+ prompt: promptInput.value.trim()
738
+ })
739
+ });
740
+
741
+ if (!res.ok) throw new Error('Video generation failed');
742
+ const data = await res.json();
743
+ console.log('Video generated:', data);
744
+
745
  videoLoading.classList.add('hidden');
746
  videoPreview.classList.remove('hidden');
747
  showToast("Video generated successfully!");
748
+
749
+ } catch (err) {
750
+ console.error('Video generation error:', err);
751
+ showToast('Video generation failed. Please try again.');
752
+ videoLoading.classList.add('hidden');
753
+ }
754
  }
755
 
756
+ async function selectPlan(plan) {
757
  selectedPlan = plan;
758
 
759
+ // Mock API call
760
+ try {
761
+ const res = await fetch("https://rahul7star-ohamlab-uploader.hf.space/update-plan", {
762
+ method: "POST",
763
+ headers: {
764
+ 'Content-Type': 'application/json'
765
+ },
766
+ body: JSON.stringify({
767
+ plan: plan
768
+ })
769
+ });
770
+
771
+ if (!res.ok) throw new Error('Plan update failed');
772
+ const data = await res.json();
773
+ console.log('Plan updated:', data);
774
+
775
+ // Update UI
776
+ planCards.forEach(card => {
777
+ if (card.dataset.plan === plan) {
778
+ card.classList.add('selected-plan');
779
+ card.querySelector('button').classList.add('bg-indigo-600', 'text-white');
780
+ card.querySelector('button').classList.remove('border-gray-300', 'text-gray-700');
781
+ } else {
782
+ card.classList.remove('selected-plan');
783
+ card.querySelector('button').classList.remove('bg-indigo-600', 'text-white');
784
+ card.querySelector('button').classList.add('border-gray-300', 'text-gray-700');
785
+ }
786
+ });
787
+
788
+ // Show confirmation
789
+ planConfirmation.classList.remove('hidden');
790
+ setTimeout(() => {
791
+ planConfirmation.classList.add('hidden');
792
+ }, 3000);
793
+
794
+ } catch (err) {
795
+ console.error('Plan update error:', err);
796
+ showToast('Plan update failed. Please try again.');
797
+ }
798
  }
799
 
800
  function showToast(message) {