atlury commited on
Commit
28fce63
·
verified ·
1 Parent(s): fa23e99

Upload 2 files

Browse files
Files changed (2) hide show
  1. digital.human.video.js +64 -18
  2. finalwork4.html +821 -0
digital.human.video.js CHANGED
@@ -381,7 +381,7 @@ document.addEventListener("DOMContentLoaded", () => {
381
  utterance.voice = selectedVoice;
382
  }
383
 
384
- // Assign rate and pitch from sliders
385
  const rate = parseFloat(document.getElementById("video-speech-rate").value);
386
  const pitch = parseFloat(document.getElementById("video-speech-pitch").value);
387
  utterance.rate = rate; // Adjust the speaking rate (0.1 to 10)
@@ -644,11 +644,6 @@ document.addEventListener("DOMContentLoaded", () => {
644
  reader.readAsDataURL(file);
645
  });
646
 
647
-
648
-
649
-
650
- // ------------------ Additions Start Here ------------------
651
-
652
  // ===== Modified: Send Image to API via CORS Anywhere =====
653
 
654
  /**
@@ -669,17 +664,12 @@ document.addEventListener("DOMContentLoaded", () => {
669
  "Content-Type": "application/json"
670
  };
671
 
672
- if (imageB64.length > 180000) {
673
- alert("To upload larger images, use the assets API (see docs)");
674
- return;
675
- }
676
-
677
  const payload = {
678
  "model": "microsoft/phi-3.5-vision-instruct",
679
  "messages": [
680
  {
681
  "role": "user",
682
- "content": `Describe the image and solve it. <img src="data:image/png;base64,${imageB64}" />`
683
  }
684
  ],
685
  "max_tokens": 512,
@@ -724,13 +714,17 @@ document.addEventListener("DOMContentLoaded", () => {
724
  // Event listener for Explain button (Webcam)
725
  document.getElementById("capture-webcam-button").addEventListener("click", function() {
726
  const video = document.getElementById("webcam-video");
727
- const canvas = document.createElement("canvas");
728
- canvas.width = video.videoWidth;
729
- canvas.height = video.videoHeight;
730
  const context = canvas.getContext("2d");
 
 
 
 
 
 
731
  context.drawImage(video, 0, 0, canvas.width, canvas.height);
732
 
733
- const imageDataURL = canvas.toDataURL("image/png");
734
  const imageB64 = imageDataURL.replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
735
 
736
  const userMessage = {
@@ -753,11 +747,45 @@ document.addEventListener("DOMContentLoaded", () => {
753
  // Event listener for Discuss button (Draw tab)
754
  document.getElementById("discuss-button").addEventListener("click", function() {
755
  const canvas = document.getElementById("draw-canvas");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
756
  const imageDataURL = canvas.toDataURL("image/png");
757
  const imageB64 = imageDataURL.replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
758
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
759
  const userMessage = {
760
- content: "Describe the image and solve it.",
761
  role: "user"
762
  };
763
  videoAppendMessage(userMessage);
@@ -773,6 +801,16 @@ document.addEventListener("DOMContentLoaded", () => {
773
  });
774
  });
775
 
 
 
 
 
 
 
 
 
 
 
776
  // Tab Switching Functionality
777
  const tabButtons = document.querySelectorAll('.image-tabs .tab-button');
778
  const tabContents = document.querySelectorAll('.video-image-section .tab-content');
@@ -787,7 +825,7 @@ document.addEventListener("DOMContentLoaded", () => {
787
  // Hide all tab contents
788
  tabContents.forEach(content => content.classList.add('hidden'));
789
 
790
- // Show the selected tab content
791
  const selectedTab = button.getAttribute('data-tab');
792
  document.querySelector(`.video-image-section .${selectedTab}-tab`).classList.remove("hidden");
793
 
@@ -893,12 +931,20 @@ document.addEventListener("DOMContentLoaded", () => {
893
  canvas.width = canvas.offsetWidth;
894
  canvas.height = 400; // Fixed height
895
 
 
 
 
 
896
  // Set initial styles
897
  ctxDraw.strokeStyle = currentColor;
898
  ctxDraw.lineWidth = currentSize;
899
  ctxDraw.lineJoin = 'round';
900
  ctxDraw.lineCap = 'round';
901
 
 
 
 
 
902
  // Mouse Events
903
  canvas.addEventListener('mousedown', (e) => {
904
  draw = true;
 
381
  utterance.voice = selectedVoice;
382
  }
383
 
384
+ // Assign rate and pitch from sliders
385
  const rate = parseFloat(document.getElementById("video-speech-rate").value);
386
  const pitch = parseFloat(document.getElementById("video-speech-pitch").value);
387
  utterance.rate = rate; // Adjust the speaking rate (0.1 to 10)
 
644
  reader.readAsDataURL(file);
645
  });
646
 
 
 
 
 
 
647
  // ===== Modified: Send Image to API via CORS Anywhere =====
648
 
649
  /**
 
664
  "Content-Type": "application/json"
665
  };
666
 
 
 
 
 
 
667
  const payload = {
668
  "model": "microsoft/phi-3.5-vision-instruct",
669
  "messages": [
670
  {
671
  "role": "user",
672
+ "content": `Describe the image and solve it. <img src="data:image/jpeg;base64,${imageB64}" />`
673
  }
674
  ],
675
  "max_tokens": 512,
 
714
  // Event listener for Explain button (Webcam)
715
  document.getElementById("capture-webcam-button").addEventListener("click", function() {
716
  const video = document.getElementById("webcam-video");
717
+ const canvas = document.getElementById("webcam-canvas");
 
 
718
  const context = canvas.getContext("2d");
719
+
720
+ // Set canvas size to desired dimensions (e.g., 640x480)
721
+ canvas.width = 640;
722
+ canvas.height = 480;
723
+
724
+ // Draw the video frame onto the canvas, scaling it to fit
725
  context.drawImage(video, 0, 0, canvas.width, canvas.height);
726
 
727
+ const imageDataURL = canvas.toDataURL("image/jpeg", 0.8); // Use JPEG for smaller file size
728
  const imageB64 = imageDataURL.replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
729
 
730
  const userMessage = {
 
747
  // Event listener for Discuss button (Draw tab)
748
  document.getElementById("discuss-button").addEventListener("click", function() {
749
  const canvas = document.getElementById("draw-canvas");
750
+
751
+ const ctx = canvas.getContext('2d');
752
+
753
+ // Check if the canvas is empty
754
+ const isCanvasBlank = ctx.getImageData(0, 0, canvas.width, canvas.height).data.every(channel => channel === 0);
755
+
756
+ if (isCanvasBlank) {
757
+ console.log("Canvas is blank. Please draw something before analyzing.");
758
+ alert("The canvas is empty. Please draw something before analyzing.");
759
+ return;
760
+ }
761
+
762
+
763
+
764
+
765
  const imageDataURL = canvas.toDataURL("image/png");
766
  const imageB64 = imageDataURL.replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
767
 
768
+ console.log('Canvas dimensions:', canvas.width, 'x', canvas.height);
769
+ console.log('Image data length:', imageB64.length);
770
+ console.log('First 100 characters of image data:', imageB64.substring(0, 100));
771
+
772
+
773
+ // Create a visual confirmation for the user
774
+ //const confirmationImage = new Image();
775
+ //confirmationImage.src = imageDataURL;
776
+ //confirmationImage.onload = function() {
777
+ // const confirmationCanvas = document.createElement('canvas');
778
+ // confirmationCanvas.width = this.width;
779
+ // confirmationCanvas.height = this.height;
780
+ // const confirmCtx = confirmationCanvas.getContext('2d');
781
+ // confirmCtx.drawImage(this, 0, 0);
782
+
783
+ // document.body.appendChild(confirmationCanvas);
784
+ // setTimeout(() => document.body.removeChild(confirmationCanvas), 5000); // Remove after 5 seconds
785
+ //};
786
+
787
  const userMessage = {
788
+ content: "Describe the image mathematically and solve it.",
789
  role: "user"
790
  };
791
  videoAppendMessage(userMessage);
 
801
  });
802
  });
803
 
804
+
805
+ // Function to check if the canvas is blank
806
+ function isCanvasBlank(canvas) {
807
+ const context = canvas.getContext('2d');
808
+ const pixelBuffer = new Uint32Array(
809
+ context.getImageData(0, 0, canvas.width, canvas.height).data.buffer
810
+ );
811
+ return !pixelBuffer.some(color => color !== 0);
812
+ }
813
+
814
  // Tab Switching Functionality
815
  const tabButtons = document.querySelectorAll('.image-tabs .tab-button');
816
  const tabContents = document.querySelectorAll('.video-image-section .tab-content');
 
825
  // Hide all tab contents
826
  tabContents.forEach(content => content.classList.add('hidden'));
827
 
828
+ // Show the selected tab content
829
  const selectedTab = button.getAttribute('data-tab');
830
  document.querySelector(`.video-image-section .${selectedTab}-tab`).classList.remove("hidden");
831
 
 
931
  canvas.width = canvas.offsetWidth;
932
  canvas.height = 400; // Fixed height
933
 
934
+ //added by rahul
935
+ canvas.style.backgroundColor = 'white';
936
+
937
+
938
  // Set initial styles
939
  ctxDraw.strokeStyle = currentColor;
940
  ctxDraw.lineWidth = currentSize;
941
  ctxDraw.lineJoin = 'round';
942
  ctxDraw.lineCap = 'round';
943
 
944
+ //added by rahul
945
+ ctxDraw.fillStyle ='white'
946
+ ctxDraw.fillRect(0, 0, canvas.width, canvas.height);
947
+
948
  // Mouse Events
949
  canvas.addEventListener('mousedown', (e) => {
950
  draw = true;
finalwork4.html ADDED
@@ -0,0 +1,821 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Aged Guru</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <!-- Google Fonts for better typography -->
8
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Roboto:wght@400;500&display=swap" rel="stylesheet">
9
+ <!-- Include necessary CSS styles -->
10
+ <link rel="stylesheet" href="base.css">
11
+ <link rel="stylesheet" href="coder.css">
12
+ <link rel="stylesheet" href="digital.human.video.css">
13
+ <link rel="stylesheet" href="digital.human.audio.css">
14
+ <link rel="stylesheet" href="advanced.math.css">
15
+ <link rel="stylesheet" href="interdisciplinary.css"> <!-- New CSS for Interdisciplinary -->
16
+ <link rel="stylesheet" href="podcast.css">
17
+ <link rel="stylesheet" href="insights.css">
18
+ <!-- Add new CSS for 3D Explorer -->
19
+ <link rel="stylesheet" href="3d-explorer.css">
20
+ </head>
21
+ <body>
22
+
23
+ <!-- Sidebar -->
24
+ <div class="sidebar">
25
+ <h2>AGED GURU</h2>
26
+
27
+ <a href="#" class="active" data-content="home">Home</a>
28
+
29
+ <a href="#" data-content="remotevoice">Digital Human</a>
30
+ <a href="#" data-content="video">Workbench</a>
31
+ <a href="#" data-content="coder">Young Coder</a>
32
+
33
+ <!-- <a href="#" data-content="voice">Digital Human Voice</a> -->
34
+ <!-- <a href="#" data-content="interdisciplinary">Interdisciplinary Studies & Advanced Math</a> -->
35
+ <!-- <a href="#" data-content="advanced-math">Advanced Mathematics & Problem Solving</a> -->
36
+
37
+ <a href="#" data-content="insights">Insights</a>
38
+ <a href="#" data-content="podcast">Podcast</a>
39
+
40
+ <a href="#" data-content="magazines-base">Workshop & Wisdom</a>
41
+ <a href="#" data-content="digitaldustbin-base">Digital Dustbin</a>
42
+ <a href="#" data-content="treasured-base">Treasured Teachings</a>
43
+
44
+ <a href="#" data-content="3d-explorer">3D Explorer</a>
45
+ <a href="#" data-content="digital-twin">Digital Twin</a>
46
+
47
+ </div>
48
+
49
+ <!-- Main Content -->
50
+ <div class="main-content" id="main-content">
51
+ <div class="header">
52
+ <h1>5-MIN SCIENTIST PORTAL</h1>
53
+ <!-- You can add user profile or settings here -->
54
+ </div>
55
+ <!-- Content will be loaded here -->
56
+ <div id="content-area">
57
+
58
+
59
+
60
+ <!-- --------------------Home Starts------------------------------------------- -->
61
+ <div id="home" class="content-section">
62
+
63
+
64
+ </div>
65
+ <!-- --------------------Home ends---------------------------------------------- -->
66
+
67
+ <!-- --------------------Remote Voice Starts------------------------------------------- -->
68
+ <div id="remotevoice" class="content-section hidden">
69
+ <div class="card">
70
+ <iframe src="https://demo.dailybots.ai/"
71
+ width="100%"
72
+ height="600px"
73
+ style="border: none; border-radius: 12px;"
74
+ title="Document Podcast"
75
+ allow="microphone">
76
+ </iframe>
77
+ </div>
78
+ </div>
79
+ <!-- --------------------Remote Voice ends---------------------------------------------- -->
80
+
81
+
82
+
83
+
84
+ <!-- -----------------Digital Human Voice Content Starts---------------- -->
85
+ <div id="voice" class="content-section hidden">
86
+ <div class="card voice-card">
87
+ <!-- Digital Human Voice Layout -->
88
+ <div class="voice-options">
89
+ <!-- Model Selection Section -->
90
+ <div id="voice-model-selection-container" class="option-section">
91
+ <label for="voice-model-selection">Select Model:</label>
92
+ <select id="voice-model-selection"></select>
93
+ <button id="voice-download" disabled>Initialize Model</button>
94
+ </div>
95
+
96
+ <!-- Voice Selection Section -->
97
+ <div id="voice-tool-selection-container" class="option-section">
98
+ <label for="voice-tools">Select Voice:</label>
99
+ <select id="voice-tools"></select>
100
+ </div>
101
+
102
+ <!-- Speech Controls Section -->
103
+ <div id="voice-speech-controls" class="option-section">
104
+ <label for="voice-speech-rate">Speech Rate:</label>
105
+ <input type="range" id="voice-speech-rate" min="0.5" max="2" step="0.1" value="1" disabled>
106
+
107
+ <label for="voice-speech-pitch">Speech Pitch:</label>
108
+ <input type="range" id="voice-speech-pitch" min="0" max="2" step="0.1" value="1" disabled>
109
+ </div>
110
+
111
+ <!-- Logs Section -->
112
+ <div id="voice-logs-container" class="option-section">
113
+ <h3>Logs</h3>
114
+ <div id="voice-logs">
115
+ <!-- Logs will appear here -->
116
+ </div>
117
+ <button id="voice-clear-logs">Clear Logs</button>
118
+ </div>
119
+ </div>
120
+
121
+ <div class="chat-window">
122
+ <!-- Chat Box Section -->
123
+ <div id="voice-chat-container">
124
+ <div id="voice-chat-box">
125
+ <!-- Chat messages will appear here -->
126
+ </div>
127
+
128
+ <!-- Chat Stats -->
129
+ <div id="voice-chat-stats" class="hidden">Runtime Stats: N/A</div>
130
+
131
+ <!-- Chat Input Section -->
132
+ <div id="voice-text-input-container">
133
+ <input type="text" id="voice-text-input" placeholder="Type your message here..." disabled>
134
+ <button id="voice-submit-button" disabled>Send</button>
135
+ </div>
136
+
137
+ <!-- Microphone Controls -->
138
+ <div id="voice-mic-container">
139
+ <button id="voice-start_button" aria-label="Start Voice Input" disabled>
140
+ <!-- Mic Icon SVG -->
141
+ <svg class="mic-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
142
+ <path d="M12 14a3 3 0 003-3V5a3 3 0 00-6 0v6a3 3 0 003 3zm5-3a5 5 0 01-10 0H5a7 7 0 0014 0h-2z"/>
143
+ </svg>
144
+ </button>
145
+ <button id="voice-stop_button" aria-label="Stop Speech" disabled>
146
+ <!-- Stop Icon SVG -->
147
+ <svg class="stop-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
148
+ <rect x="6" y="6" width="12" height="12" rx="2" ry="2"></rect>
149
+ </svg>
150
+ </button>
151
+ </div>
152
+ </div>
153
+
154
+ <!-- Loading Spinner -->
155
+ <div id="voice-loading-spinner" class="hidden">
156
+ <div class="spinner"></div>
157
+ </div>
158
+
159
+ <!-- Configuration Info -->
160
+ <div id="voice-configuration" class="hidden">
161
+ <p>Model Initialized: <span id="voice-selected-model">N/A</span></p>
162
+ </div>
163
+ </div>
164
+ </div>
165
+ </div>
166
+ <!-- -----------------Digital Human Voice Content Ends---------------- -->
167
+
168
+
169
+
170
+
171
+
172
+ <!-- --------------------Digital Human Mentor Video Content Starts---------------- -->
173
+ <div id="video" class="content-section hidden">
174
+ <div class="card video-card">
175
+ <!-- Video Options -->
176
+ <div class="video-options">
177
+ <!-- Model Selection Section -->
178
+ <div id="video-model-selection-container" class="option-section">
179
+ <label for="video-model-selection">Select Model:</label>
180
+ <select id="video-model-selection"></select>
181
+ <button id="video-download" disabled>Initialize Model</button>
182
+ </div>
183
+
184
+ <!-- Voice Selection Section -->
185
+ <div id="video-tool-selection-container" class="option-section">
186
+ <label for="video-tools">Select Voice:</label>
187
+ <select id="video-tools"></select>
188
+ </div>
189
+
190
+ <!-- Speech Controls Section -->
191
+ <div id="video-speech-controls" class="option-section">
192
+ <label for="video-speech-rate">Speech Rate:</label>
193
+ <input type="range" id="video-speech-rate" min="0.5" max="2" step="0.1" value="1" disabled>
194
+
195
+ <label for="video-speech-pitch">Speech Pitch:</label>
196
+ <input type="range" id="video-speech-pitch" min="0" max="2" step="0.1" value="1" disabled>
197
+ </div>
198
+
199
+ <!-- Logs Section -->
200
+ <div id="video-logs-container" class="option-section">
201
+ <h3>Logs</h3>
202
+ <div id="video-logs">
203
+ <!-- Logs will appear here -->
204
+ </div>
205
+ <button id="video-clear-logs">Clear Logs</button>
206
+ </div>
207
+ </div>
208
+
209
+ <!-- New: Wrapper for Chat Window and Image Upload Section -->
210
+ <div class="video-main">
211
+ <!-- Chat Window Section -->
212
+ <div class="chat-window">
213
+ <!-- Chat Box Section -->
214
+ <div id="video-chat-container">
215
+ <div id="video-chat-box">
216
+ <!-- Chat messages will appear here -->
217
+ </div>
218
+
219
+ <!-- Chat Stats -->
220
+ <div id="video-chat-stats" class="hidden">Runtime Stats: N/A</div>
221
+
222
+ <!-- Chat Input Section -->
223
+ <div id="video-text-input-container">
224
+ <input type="text" id="video-text-input" placeholder="Type your message here..." disabled>
225
+ <button id="video-submit-button" disabled>Send</button>
226
+ </div>
227
+
228
+ <!-- Microphone Controls -->
229
+ <div id="video-mic-container">
230
+ <button id="video-start_button" aria-label="Start Voice Input" disabled>
231
+ <!-- Mic Icon SVG -->
232
+ <svg class="mic-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
233
+ <path d="M12 14a3 3 0 003-3V5a3 3 0 00-6 0v6a3 3 0 003 3zm5-3a5 5 0 01-10 0H5a7 7 0 0014 0h-2z"/>
234
+ </svg>
235
+ </button>
236
+ <button id="video-stop_button" aria-label="Stop Speech" disabled>
237
+ <!-- Stop Icon SVG -->
238
+ <svg class="stop-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
239
+ <rect x="6" y="6" width="12" height="12" rx="2" ry="2"></rect>
240
+ </svg>
241
+ </button>
242
+ </div>
243
+ </div>
244
+
245
+ <!-- Loading Spinner -->
246
+ <div id="video-loading-spinner" class="hidden">
247
+ <div class="spinner"></div>
248
+ </div>
249
+
250
+ <!-- Configuration Info -->
251
+ <div id="video-configuration" class="hidden">
252
+ <p>Model Initialized: <span id="video-selected-model">N/A</span></p>
253
+ </div>
254
+ </div>
255
+
256
+ <!-- Image Upload and Canvas Section -->
257
+ <div class="video-image-section">
258
+ <!-- Tab Navigation -->
259
+ <div class="image-tabs">
260
+ <button class="tab-button active" data-tab="upload">Upload Image</button>
261
+ <button class="tab-button" data-tab="webcam">Webcam</button>
262
+ <button class="tab-button" data-tab="draw">Draw</button>
263
+ </div>
264
+
265
+ <!-- Tab Contents -->
266
+ <div class="tab-content upload-tab">
267
+ <h3>Upload and Analyze Image</h3>
268
+ <input type="file" id="video-image-upload" accept="image/*" />
269
+ <canvas id="video-image-canvas"></canvas>
270
+ <button id="analyze-button">Analyze</button>
271
+ </div>
272
+
273
+ <div class="tab-content webcam-tab hidden">
274
+ <h3>Webcam Capture</h3>
275
+ <video id="webcam-video" autoplay playsinline></video>
276
+ <canvas id="webcam-canvas" style="display:none;"></canvas>
277
+ <button id="capture-webcam-button">Explain Image</button>
278
+ </div>
279
+
280
+ <div class="tab-content draw-tab hidden">
281
+ <h3>Draw on Canvas</h3>
282
+ <canvas id="draw-canvas"></canvas>
283
+ <div class="draw-controls">
284
+ <button id="clear-draw-button">Clear Drawing</button>
285
+ <label for="draw-color">Color:</label>
286
+ <input type="color" id="draw-color" value="#000000">
287
+ <label for="draw-size">Size:</label>
288
+ <input type="range" id="draw-size" min="1" max="10" value="2">
289
+ <button id="discuss-button">Discuss</button>
290
+ </div>
291
+ </div>
292
+ </div>
293
+
294
+
295
+
296
+ </div>
297
+ </div>
298
+ </div>
299
+ <!-- --------------------Digital Human Mentor Video Content Ends----------------- -->
300
+
301
+
302
+
303
+
304
+
305
+ <!-- --------------------Coder Content Starts------------------------------------- -->
306
+ <div id="coder" class="content-section hidden">
307
+ <div class="card coder-card">
308
+ <!-- Wrapper for Top Options -->
309
+ <div class="coder-options">
310
+ <!-- Model Selection Section -->
311
+ <div id="coder-model-selection-container" class="option-section">
312
+ <label for="coder-model-selection">Select Model:</label>
313
+ <div class="option-control-group">
314
+ <select id="coder-model-selection"></select>
315
+ <button id="coder-download" disabled>Initialize Model</button>
316
+ </div>
317
+ </div>
318
+
319
+ <!-- Voice Selection Section -->
320
+ <div id="coder-tool-selection-container" class="option-section">
321
+ <label for="coder-tools">Select Voice:</label>
322
+ <select id="coder-tools"></select>
323
+ </div>
324
+
325
+ <!-- Speech Controls Section -->
326
+ <div id="coder-speech-controls" class="option-section">
327
+ <label for="coder-speech-rate">Speech Rate:</label>
328
+ <input type="range" id="coder-speech-rate" min="0.5" max="2" step="0.1" value="1" disabled>
329
+
330
+ <label for="coder-speech-pitch">Speech Pitch:</label>
331
+ <input type="range" id="coder-speech-pitch" min="0" max="2" step="0.1" value="1" disabled>
332
+ </div>
333
+
334
+ <!-- Logs Section -->
335
+ <div id="coder-logs-container" class="option-section">
336
+ <h3>Logs</h3>
337
+ <div id="coder-logs">
338
+ <!-- Logs will appear here -->
339
+ </div>
340
+ <button id="coder-clear-logs">Clear Logs</button>
341
+ </div>
342
+ </div>
343
+ <!-- End of Top Options Wrapper -->
344
+
345
+ <!-- Wrapper for Chat and Python Interpreter -->
346
+ <div class="coder-main" style="display: flex; flex-direction: row; gap: 20px;">
347
+ <!-- Chat Window Section -->
348
+ <div class="chat-window" style="flex: 2;">
349
+ <!-- Chat Box Section -->
350
+ <div id="coder-chat-container">
351
+ <div id="coder-chat-box">
352
+ <!-- Chat messages will appear here -->
353
+ </div>
354
+
355
+ <!-- Chat Stats -->
356
+ <div id="coder-chat-stats" class="hidden">Runtime Stats: N/A</div>
357
+
358
+ <!-- Chat Input Section -->
359
+ <div id="coder-text-input-container">
360
+ <input type="text" id="coder-text-input" placeholder="Type your message here..." disabled>
361
+ <button id="coder-submit-button" disabled>Send</button>
362
+ </div>
363
+
364
+ <!-- Microphone Controls -->
365
+ <div id="coder-mic-container">
366
+ <button id="coder-start_button" aria-label="Start Voice Input" disabled>
367
+ <!-- Mic Icon SVG -->
368
+ <svg class="mic-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
369
+ <path d="M12 14a3 3 0 003-3V5a3 3 0 00-6 0v6a3 3 0 003 3zm5-3a5 5 0 01-10 0H5a7 7 0 0014 0h-2z"/>
370
+ </svg>
371
+ </button>
372
+ <button id="coder-stop_button" aria-label="Stop Speech" disabled>
373
+ <!-- Stop Icon SVG -->
374
+ <svg class="stop-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
375
+ <rect x="6" y="6" width="12" height="12" rx="2" ry="2"></rect>
376
+ </svg>
377
+ </button>
378
+ </div>
379
+ </div>
380
+
381
+ <!-- Loading Spinner -->
382
+ <div id="coder-loading-spinner" class="hidden">
383
+ <div class="spinner"></div>
384
+ </div>
385
+
386
+ <!-- Configuration Info -->
387
+ <div id="coder-configuration" class="hidden">
388
+ <p>Model Initialized: <span id="coder-selected-model">N/A</span></p>
389
+ </div>
390
+ </div>
391
+ <!-- End of Chat Window Section -->
392
+
393
+ <!-- Python Interpreter Section -->
394
+ <div id="coder-python-container" style="flex: 1; display: flex; flex-direction: column; gap: 10px;">
395
+ <iframe src="https://pyodide.org/en/stable/console.html" style="flex: 1; border: none; border-radius: var(--border-radius);"></iframe>
396
+ </div>
397
+ <!-- End of Python Interpreter Section -->
398
+ </div>
399
+ <!-- End of Wrapper for Chat and Python Interpreter -->
400
+
401
+ <!-- Loading Spinner and Configuration Info (if any additional) can remain as is -->
402
+ </div>
403
+ </div>
404
+ <!-- --------------------Coder Content Ends---------------------------------------- -->
405
+
406
+
407
+
408
+
409
+ <!-- --------------------Math Content Starts--------------------------------------- -->
410
+ <div id="advanced-math" class="content-section hidden">
411
+ <div class="card advanced-math-card">
412
+ <!-- Top Controls -->
413
+ <div class="math-options">
414
+ <!-- Model Selection Section -->
415
+ <div id="math-model-selection-container" class="option-section">
416
+ <label for="math-model-selection">Select Math Model:</label>
417
+ <select id="math-model-selection"></select>
418
+ <button id="math-download" disabled>Initialize Model</button>
419
+ </div>
420
+
421
+ <!-- Tool Selection Section -->
422
+ <div id="math-tool-selection-container" class="option-section">
423
+ <label for="math-tools">Select Voice:</label>
424
+ <select id="math-tools"></select>
425
+ </div>
426
+
427
+ <!-- Speech Controls Section -->
428
+ <div id="math-speech-controls" class="option-section">
429
+ <label for="math-speech-rate">Speech Rate:</label>
430
+ <input type="range" id="math-speech-rate" min="0.5" max="2" step="0.1" value="1" disabled>
431
+
432
+ <label for="math-speech-pitch">Speech Pitch:</label>
433
+ <input type="range" id="math-speech-pitch" min="0" max="2" step="0.1" value="1" disabled>
434
+ </div>
435
+
436
+ <!-- Logs Section -->
437
+ <div id="math-logs-container" class="option-section">
438
+ <h3>Logs</h3>
439
+ <div id="math-logs">
440
+ <!-- Logs will appear here -->
441
+ </div>
442
+ <button id="math-clear-logs">Clear Logs</button>
443
+ </div>
444
+ </div>
445
+
446
+ <!-- Chat Window Section -->
447
+ <div class="chat-window">
448
+ <!-- Chat Box Section -->
449
+ <div id="math-chat-container">
450
+ <div id="math-chat-box">
451
+ <!-- Chat messages will appear here -->
452
+ </div>
453
+
454
+ <!-- Chat Stats -->
455
+ <div id="math-chat-stats" class="hidden">Runtime Stats: N/A</div>
456
+
457
+ <!-- Chat Input Section -->
458
+ <div id="math-text-input-container">
459
+ <input type="text" id="math-text-input" placeholder="Type your math problem here..." disabled>
460
+ <button id="math-submit-button" disabled>Submit</button>
461
+ </div>
462
+
463
+ <!-- Microphone Controls -->
464
+ <div id="math-mic-container">
465
+ <button id="math-start_button" aria-label="Start Voice Input" disabled>
466
+ <!-- Mic Icon SVG -->
467
+ <svg class="mic-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
468
+ <path d="M12 14a3 3 0 003-3V5a3 3 0 00-6 0v6a3 3 0 003 3zm5-3a5 5 0 01-10 0H5a7 7 0 0014 0h-2z"/>
469
+ </svg>
470
+ </button>
471
+ <button id="math-stop_button" aria-label="Stop Speech" disabled>
472
+ <!-- Stop Icon SVG -->
473
+ <svg class="stop-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
474
+ <rect x="6" y="6" width="12" height="12" rx="2" ry="2"></rect>
475
+ </svg>
476
+ </button>
477
+ </div>
478
+ </div>
479
+
480
+ <!-- Loading Spinner -->
481
+ <div id="math-loading-spinner" class="hidden">
482
+ <div class="spinner"></div>
483
+ </div>
484
+
485
+ <!-- Configuration Info -->
486
+ <div id="math-configuration" class="hidden">
487
+ <p>Model Initialized: <span id="math-selected-model">N/A</span></p>
488
+ </div>
489
+ </div>
490
+ </div>
491
+ </div>
492
+ <!-- --------------------Math Content Ends----------------------------------------------- -->
493
+
494
+
495
+
496
+
497
+ <!-- --------------------Interdisciplinary Content Starts-------------------------------- -->
498
+ <div id="interdisciplinary" class="content-section hidden">
499
+ <div class="card interdisciplinary-card">
500
+ <!-- Interdisciplinary Studies Assistant Layout -->
501
+ <div class="inter-options">
502
+ <!-- Model Selection Section -->
503
+ <div id="inter-model-selection-container" class="option-section">
504
+ <label for="inter-model-selection">Select Model:</label>
505
+ <select id="inter-model-selection"></select>
506
+ <button id="inter-download" disabled>Initialize Model</button>
507
+ </div>
508
+
509
+ <!-- Voice Selection Section -->
510
+ <div id="inter-tool-selection-container" class="option-section">
511
+ <label for="inter-tools">Select Voice:</label>
512
+ <select id="inter-tools"></select>
513
+ </div>
514
+
515
+ <!-- Speech Controls Section -->
516
+ <div id="inter-speech-controls" class="option-section">
517
+ <label for="speech-rate">Speech Rate:</label>
518
+ <input type="range" id="speech-rate" min="0.5" max="2" step="0.1" value="1" disabled>
519
+
520
+ <label for="speech-pitch">Speech Pitch:</label>
521
+ <input type="range" id="speech-pitch" min="0" max="2" step="0.1" value="1" disabled>
522
+ </div>
523
+
524
+ <!-- Logs Section -->
525
+ <div id="inter-logs-container" class="option-section">
526
+ <h3>Logs</h3>
527
+ <div id="inter-logs">
528
+ <!-- Logs will appear here -->
529
+ </div>
530
+ <button id="inter-clear-logs">Clear Logs</button>
531
+ </div>
532
+ </div>
533
+
534
+ <div class="chat-window">
535
+ <!-- Chat Box Section -->
536
+ <div id="inter-chat-container">
537
+ <div id="inter-chat-box">
538
+ <!-- Chat messages will appear here -->
539
+ </div>
540
+
541
+ <!-- Chat Stats -->
542
+ <div id="inter-chat-stats" class="hidden">Runtime Stats: N/A</div>
543
+
544
+ <!-- Chat Input Section -->
545
+ <div id="inter-text-input-container">
546
+ <input type="text" id="inter-text-input" placeholder="Type your message here..." disabled>
547
+ <button id="inter-submit-button" disabled>Send</button>
548
+ </div>
549
+
550
+ <!-- Microphone Controls -->
551
+ <div id="inter-mic-container">
552
+ <button id="inter-start_button" aria-label="Start Voice Input" disabled>
553
+ <!-- Mic Icon SVG -->
554
+ <svg class="mic-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
555
+ <path d="M12 14a3 3 0 003-3V5a3 3 0 00-6 0v6a3 3 0 003 3zm5-3a5 5 0 01-10 0H5a7 7 0 0014 0h-2z"/>
556
+ </svg>
557
+ </button>
558
+ <button id="inter-stop_button" aria-label="Stop Speech" disabled>
559
+ <!-- Stop Icon SVG -->
560
+ <svg class="stop-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
561
+ <rect x="6" y="6" width="12" height="12" rx="2" ry="2"></rect>
562
+ </svg>
563
+ </button>
564
+ </div>
565
+ </div>
566
+
567
+ <!-- Loading Spinner -->
568
+ <div id="loading-spinner" class="hidden">
569
+ <div class="spinner"></div>
570
+ </div>
571
+
572
+ <!-- Configuration Info -->
573
+ <div id="inter-configuration" class="hidden">
574
+ <p>Model Initialized: <span id="inter-selected-model">N/A</span></p>
575
+ </div>
576
+ </div>
577
+ </div>
578
+ </div>
579
+ <!-- --------------------Interdisciplinary Content Ends------------------------------------- -->
580
+
581
+
582
+
583
+
584
+ <!-- --------------------Insights Content Starts------------------------------------------- -->
585
+ <div id="insights" class="content-section hidden">
586
+ <div class="card">
587
+
588
+ <!-- New: Insights Tabs -->
589
+ <div class="insights-tabs">
590
+ <button class="insights-tab-button active" data-insights-tab="pdf">Insights PDF</button>
591
+ <button class="insights-tab-button" data-insights-tab="images">Insights Images</button>
592
+ <button class="insights-tab-button" data-insights-tab="translator">Translator</button>
593
+ <button class="insights-tab-button" data-insights-tab="youtube">Youtube Summarizer</button>
594
+ </div>
595
+
596
+ <!-- New: Insights Tab Contents -->
597
+ <div class="insights-tab-content">
598
+ <!-- Insights PDF Content -->
599
+ <div id="pdf" class="insights-content active">
600
+ <iframe
601
+ src="https://cin-model-kotaemon-demo.hf.space/"
602
+ width="100%"
603
+ height="600px"
604
+ style="border: none; border-radius: 12px;"
605
+ title="Insights PDF"
606
+ ></iframe>
607
+ </div>
608
+
609
+ <!-- Insights Images Content -->
610
+ <div id="images" class="insights-content hidden">
611
+ <iframe
612
+ src="https://adrienb134-rag-colpali-qwen2vl.hf.space/"
613
+ width="100%"
614
+ height="600px"
615
+ style="border: none; border-radius: 12px;"
616
+ title="Insights PDF"
617
+ ></iframe>
618
+ </div>
619
+
620
+ <!-- Translator Content -->
621
+ <div id="translator" class="insights-content hidden">
622
+ <p>Content for Translator will go here.</p>
623
+ </div>
624
+
625
+ <!-- Youtube Summarizer Content -->
626
+ <div id="youtube" class="insights-content hidden">
627
+ <p>Content for Youtube Summarizer will go here.</p>
628
+ </div>
629
+ </div>
630
+ </div>
631
+ </div>
632
+ <!-- --------------------Insights Content Ends------------------------------------------- -->
633
+
634
+
635
+
636
+ <!-- --------------------Podcast Content Starts------------------------------------------- -->
637
+ <div id="podcast" class="content-section hidden">
638
+ <div class="card">
639
+
640
+ <!-- Podcast Tabs -->
641
+ <div class="podcast-tabs">
642
+ <button class="podcast-tab-button active" data-podcast-tab="document-podcast">Document Podcast</button>
643
+ <button class="podcast-tab-button" data-podcast-tab="conversational-podcast">Conversational Podcast</button>
644
+ </div>
645
+
646
+ <!-- Podcast Tab Contents -->
647
+ <div class="podcast-tab-content">
648
+ <!-- Document Podcast Content -->
649
+ <div id="document-podcast" class="podcast-content active">
650
+ <iframe src="https://lamm-mit-pdf2audio.hf.space/"
651
+ width="100%"
652
+ height="600px"
653
+ style="border: none; border-radius: 12px;"
654
+ title="Document Podcast">
655
+ </iframe>
656
+ </div>
657
+
658
+ <!-- Conversational Podcast Content -->
659
+ <div id="conversational-podcast" class="podcast-content hidden">
660
+ <iframe src="https://gabrielchua-open-notebooklm.hf.space/"
661
+ width="100%"
662
+ height="600px"
663
+ style="border: none; border-radius: 12px;"
664
+ title="Conversational Podcast">
665
+ </iframe>
666
+ </div>
667
+ </div>
668
+ <!-- End of Podcast Tab Contents -->
669
+
670
+ </div>
671
+ </div>
672
+ <!-- --------------------Podcast Content Ends--------------------------------------------- -->
673
+
674
+
675
+
676
+
677
+
678
+
679
+ <!-- --------------------3D Explorer Content Starts------------------------------------------- -->
680
+ <div id="3d-explorer" class="content-section hidden">
681
+ <div class="card">
682
+ <!-- 3D Explorer Tabs -->
683
+ <div class="explorer-tabs">
684
+ <button class="explorer-tab-button active" data-explorer-tab="stable-fast-3d">Fast 3D</button>
685
+ <button class="explorer-tab-button" data-explorer-tab="3dtopia-xl">Quality 3D</button>
686
+ </div>
687
+
688
+ <!-- 3D Explorer Tab Contents -->
689
+ <div class="explorer-tab-content">
690
+ <!-- Stable Fast 3D Content -->
691
+ <div id="stable-fast-3d" class="explorer-content active">
692
+ <iframe src="https://stabilityai-stable-fast-3d.hf.space/"
693
+ width="100%"
694
+ height="600px"
695
+ style="border: none; border-radius: 12px;"
696
+ title="Fast 3D">
697
+ </iframe>
698
+ </div>
699
+
700
+ <!-- 3Dtopia XL Content -->
701
+ <div id="3dtopia-xl" class="explorer-content hidden">
702
+ <iframe src="https://frozenburning-3dtopia-xl.hf.space/"
703
+ width="100%"
704
+ height="600px"
705
+ style="border: none; border-radius: 12px;"
706
+ title="Quality 3D">
707
+ </iframe>
708
+ </div>
709
+ </div>
710
+ </div>
711
+ </div>
712
+ <!-- --------------------3D Explorer Content Ends--------------------------------------------- -->
713
+
714
+
715
+
716
+
717
+
718
+ <!-- --------------------Magazines Base Starts------------------------------------------- -->
719
+ <div id="magazines-base" class="content-section hidden">
720
+ <div class="card">
721
+ <h2>Classic Magazines Collection</h2>
722
+ <p>Content for magazines.</p>
723
+ </div>
724
+ </div>
725
+ <!-- --------------------Magazines Base ends---------------------------------------------- -->
726
+
727
+
728
+
729
+ <!-- --------------------Treasured Teachings Starts------------------------------------------- -->
730
+ <div id="treasured-base" class="content-section hidden">
731
+ <div class="card">
732
+ <h2>Treasured Teachings</h2>
733
+ <p>Content for Treasured Teachings.</p>
734
+ </div>
735
+ </div>
736
+ <!-- --------------------Treasured Teachings ends---------------------------------------------- -->
737
+
738
+
739
+ <!-- --------------------Magazines Base Starts------------------------------------------- -->
740
+ <div id="books-base" class="content-section hidden">
741
+ <div class="card">
742
+ <h2>Books Collection</h2>
743
+ <p>Content for Books.</p>
744
+ </div>
745
+ </div>
746
+ <!-- --------------------Magazines Base ends---------------------------------------------- -->
747
+
748
+
749
+
750
+
751
+
752
+ <!-- --------------------Digital-dustin Starts------------------------------------------- -->
753
+ <div id="digitaldustbin-base" class="content-section hidden">
754
+ <div class="card">
755
+ <h2>Digital Dustbin</h2>
756
+ <p>Content for Digital Dustbin.</p>
757
+ </div>
758
+ </div>
759
+ <!-- --------------------Digital-dustin ends---------------------------------------------- -->
760
+
761
+
762
+
763
+
764
+ <div id="digital-twin" class="content-section hidden">
765
+ <div class="card">
766
+ <h2>Digital Twin</h2>
767
+ <p>Persona, Memory, Social Graph, Class Notes, Homework, Tracker.</p>
768
+ </div>
769
+ </div>
770
+ </div>
771
+
772
+
773
+
774
+
775
+ </div>
776
+
777
+ <!-- Include Axios from CDN -->
778
+ <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
779
+
780
+ <!-- Include the necessary scripts -->
781
+ <script type="module">
782
+ // Sidebar navigation
783
+ const sidebarLinks = document.querySelectorAll('.sidebar a');
784
+ const contentSections = document.querySelectorAll('.content-section');
785
+
786
+ sidebarLinks.forEach(link => {
787
+ link.addEventListener('click', (e) => {
788
+ e.preventDefault();
789
+ // Remove active class from all links
790
+ sidebarLinks.forEach(l => l.classList.remove('active'));
791
+ // Add active class to the clicked link
792
+ link.classList.add('active');
793
+
794
+ // Hide all content sections
795
+ contentSections.forEach(section => section.classList.add('hidden'));
796
+
797
+ // Show the selected content section
798
+ const target = link.getAttribute('data-content');
799
+ document.getElementById(target).classList.remove('hidden');
800
+ });
801
+ });
802
+ </script>
803
+
804
+
805
+ <!-- Include the necessary scripts -->
806
+ <!-- Include Pyodide Script -->
807
+
808
+
809
+ <script type="module" src="digital.human.audio.js"> </script>
810
+ <script type="module" src="digital.human.video.js"> </script>
811
+ <script type="module" src="coder.js"> </script>
812
+ <script type="module" src="advanced.math.js"></script>
813
+ <script type="module" src="interdisciplinary.js"></script> <!-- New JS for Interdisciplinary -->
814
+ <script type="module" src="insights.js"></script>
815
+ <script type="module" src="podcast.js"></script>
816
+
817
+ <!-- Include the new script for 3D Explorer -->
818
+ <script type="module" src="3d-explorer.js"></script>
819
+
820
+ </body>
821
+ </html>