KingNish commited on
Commit
00164ce
1 Parent(s): b442bd5

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +105 -108
index.html CHANGED
@@ -4,141 +4,138 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Video Assistant</title>
7
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
8
- <link href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
9
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
10
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
 
 
 
 
 
 
11
  <script src="https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js"></script>
12
- <style>
13
- :root {
14
- --primary-color: #4a90e2;
15
- --secondary-color: #f39c12;
16
- --accent-color: #38cb96;
17
- --background-color: #f0f4f8;
18
- --card-bg-color: #ffffff;
19
- --text-color: #333333;
20
- --border-color: #e0e0e0;
21
- --shadow-color: rgba(0, 0, 0, 0.1);
22
- --hover-shadow-color: rgba(74, 144, 226, 0.3);
23
- --hover-bg-color: #1e9b6e;
24
- --active-bg-color: #1a855d;
25
- --tooltip-bg-color: #333;
26
- --tooltip-text-color: #fff;
27
- }
28
-
29
- body {
30
- font-family: 'Roboto', sans-serif;
31
- margin: 0;
32
- padding: 0;
33
- }
34
-
35
- .container {
36
- width: 90%;
37
- max-width: 800px;
38
- margin: 0 auto;
39
- }
40
-
41
- .tooltip {
42
- display: none;
43
- position: absolute;
44
- background-color: var(--tooltip-bg-color);
45
- color: var(--tooltip-text-color);
46
- padding: 5px;
47
- border-radius: 5px;
48
- font-size: 0.8rem;
49
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
50
- }
51
-
52
- .setting:hover .tooltip {
53
- display: block;
54
- /* Show tooltip on hover */
55
- }
56
-
57
- #transcript {
58
- font-family: 'Courier New', monospace;
59
- white-space: pre-wrap;
60
- overflow-y: auto;
61
- max-height: 200px;
62
- }
63
-
64
- @media (max-width: 600px) {
65
- .settings {
66
- grid-template-columns: 1fr;
67
- }
68
- }
69
- </style>
70
  </head>
71
- <body class="bg-gradient-to-r from-blue-100 to-gray-200 flex items-center justify-center min-h-screen">
72
- <div class="container max-w-md w-full p-8 bg-white rounded-2xl shadow-xl relative">
73
- <h1 class="text-3xl font-bold text-blue-600 mb-6">Video Assistant</h1>
74
- <div id="responseTime" class="text-gray-500 text-sm mb-6">Latency: 0ms</div>
75
- <div class="indicator-wrapper flex justify-around mb-8">
76
- <div id="userIndicator" class="indicator flex items-center p-3 rounded-full bg-blue-500 text-white">
77
- <i class="fas fa-user-circle mr-2"></i>
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  <span>User: Idle</span>
79
  </div>
80
- <div id="aiIndicator" class="indicator flex items-center p-3 rounded-full bg-yellow-500 text-white">
81
- <i class="fas fa-robot mr-2"></i>
 
 
 
 
 
 
82
  <span>AI: Idle</span>
83
  </div>
84
  </div>
85
- <button id="startStopButton" class="w-full bg-green-500 text-white p-4 rounded-full shadow-lg hover:shadow-xl transition duration-300 flex items-center justify-center mb-8">
86
- <i class="fas fa-microphone mr-2"></i>
 
 
 
 
 
 
 
 
87
  Start Listening
88
  </button>
89
- <div class="settings grid grid-cols-1 gap-4 mb-8">
90
- <div class="setting flex items-center">
91
- <label for="voiceSelect" class="mr-4 text-gray-700 font-medium">Voice:</label>
92
- <select id="voiceSelect" class="w-full p-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500">
 
 
 
93
  <option value="Amy">Female</option>
94
  <option value="Brian">Male</option>
95
  </select>
96
- <span class="tooltip text-gray-500 text-sm ml-2 cursor-help">Select the voice type for the assistant.</span>
97
  </div>
98
- <div class="setting flex items-center">
99
- <label for="modelSelect" class="mr-4 text-gray-700 font-medium">Model:</label>
100
- <select id="modelSelect" class="w-full p-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500">
 
 
101
  <option value="8b">Fastest</option>
102
  <option value="70b">Powerful</option>
103
  </select>
104
- <span class="tooltip text-gray-500 text-sm ml-2 cursor-help">Choose the model type for speed or power.</span>
105
  </div>
106
- <div class="setting flex items-center">
107
- <label for="apiKey" class="mr-4 text-gray-700 font-medium">SambaNava API Key (optional):</label>
108
- <input type="password" id="apiKey" class="w-full p-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500" placeholder="Enter your API Key">
109
- <span class="tooltip text-gray-500 text-sm ml-2 cursor-help">Use SambaNova API key for enhanced speed. You can obtain a free key from <a href="https://cloud.sambanova.ai/apis" class="text-blue-500">here</a>.</span>
 
 
110
  </div>
111
  </div>
112
- <div id="transcript" class="p-4 bg-gray-100 rounded-lg overflow-y-auto max-h-96 mb-8">
113
- <!-- Transcription will appear here -->
114
- </div>
115
- <div class="webcam-container mb-6">
116
- <h2 class="text-xl font-semibold mb-2">Webcam Feed</h2>
117
- <video id="webcam" autoplay playsinline class="w-full h-auto rounded-lg shadow-lg"></video>
118
  </div>
 
119
  </div>
120
-
 
121
  <script>
 
122
  function loadScript() {
123
- var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor) && !/Edg/.test(navigator.userAgent);
124
- var isDesktop = window.innerWidth > 768;
125
- var existingScript = document.querySelector('script[src="script1.js"], script[src="script2.js"]');
126
- if (existingScript) {
127
- existingScript.remove();
128
- }
129
- var script = document.createElement('script');
130
- script.type = 'module'; // Set the script type to module
131
  if (isChrome && isDesktop) {
132
- script.src = 'script1.js';
133
  } else {
134
- script.src = 'script2.js';
 
 
 
 
 
135
  }
136
- script.onerror = function() {
137
- console.error('Error loading script:', script.src);
138
- };
139
- document.head.appendChild(script);
 
 
 
140
  }
141
- document.addEventListener('DOMContentLoaded', loadScript);
 
 
 
 
 
 
 
 
 
 
142
  </script>
143
  </body>
144
  </html>
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Video Assistant</title>
7
+ <!-- Tailwind CSS -->
8
+ <link href="https://cdn.jsdelivr.net/npm/tailwindcss@3.3.2/dist/tailwind.min.css" rel="stylesheet">
9
+ <!-- Heroicons -->
10
+ <script src="https://unpkg.com/heroicons@2.0.13/dist/heroicons.min.js" defer></script>
11
+ <!-- Tippy.js CSS -->
12
+ <link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css" />
13
+ <!-- Tippy.js -->
14
+ <script src="https://unpkg.com/@popperjs/core@2"></script>
15
+ <script src="https://unpkg.com/tippy.js@6"></script>
16
+ <!-- Gradio Client -->
17
  <script src="https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </head>
19
+ <body class="bg-gradient-to-br from-blue-100 via-blue-200 to-blue-300 font-roboto flex items-center justify-center min-h-screen p-4">
20
+ <div class="w-full max-w-4xl bg-white rounded-3xl shadow-lg p-8 relative">
21
+ <h1 class="text-4xl font-bold text-blue-600 mb-4 text-center">Video Assistant</h1>
22
+ <div id="responseTime" class="text-gray-600 mb-6 text-center">Latency: 0ms</div>
23
+
24
+ <!-- Webcam Integration -->
25
+ <div class="mt-8">
26
+ <h2 class="text-xl font-semibold text-gray-700 mb-2">Webcam Feed</h2>
27
+ <video id="webcam" autoplay playsinline class="w-full max-w-md rounded-lg shadow"></video>
28
+ </div>
29
+
30
+ <!-- Indicators -->
31
+ <div class="flex justify-center space-x-8 mb-6">
32
+ <!-- User Indicator -->
33
+ <div id="userIndicator" class="flex items-center bg-blue-500 text-white px-4 py-2 rounded-full space-x-2">
34
+ <!-- User Icon -->
35
+ <svg class="w-6 h-6" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
36
+ <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
37
+ <circle cx="12" cy="7" r="4"></circle>
38
+ </svg>
39
  <span>User: Idle</span>
40
  </div>
41
+ <!-- AI Indicator -->
42
+ <div id="aiIndicator" class="flex items-center bg-yellow-500 text-white px-4 py-2 rounded-full space-x-2">
43
+ <!-- AI Icon -->
44
+ <svg class="w-6 h-6" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
45
+ <polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
46
+ <polyline points="2 17 12 22 22 17"></polyline>
47
+ <polyline points="2 12 12 17 22 12"></polyline>
48
+ </svg>
49
  <span>AI: Idle</span>
50
  </div>
51
  </div>
52
+
53
+ <!-- Start Listening Button -->
54
+ <button id="startStopButton" class="flex items-center mx-auto bg-green-500 hover:bg-green-600 active:bg-green-700 text-white font-semibold py-3 px-6 rounded-full shadow transition transform hover:-translate-y-1">
55
+ <!-- Mic Icon -->
56
+ <svg class="w-6 h-6 mr-2" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
57
+ <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path>
58
+ <path d="M19 10v2a7 7 0 0 1-14 0v-2"></path>
59
+ <line x1="12" y1="19" x2="12" y2="23"></line>
60
+ <line x1="8" y1="23" x2="16" y2="23"></line>
61
+ </svg>
62
  Start Listening
63
  </button>
64
+
65
+ <!-- Settings -->
66
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mt-8">
67
+ <!-- Voice Selection -->
68
+ <div class="relative">
69
+ <label for="voiceSelect" class="block text-gray-700 font-semibold mb-2">Voice:</label>
70
+ <select id="voiceSelect" class="w-full p-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
71
  <option value="Amy">Female</option>
72
  <option value="Brian">Male</option>
73
  </select>
74
+ <span class="tooltip" data-tippy-content="Select the voice type for the assistant."></span>
75
  </div>
76
+
77
+ <!-- Model Selection -->
78
+ <div class="relative">
79
+ <label for="modelSelect" class="block text-gray-700 font-semibold mb-2">Model:</label>
80
+ <select id="modelSelect" class="w-full p-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-yellow-500">
81
  <option value="8b">Fastest</option>
82
  <option value="70b">Powerful</option>
83
  </select>
84
+ <span class="tooltip" data-tippy-content="Choose the model based on speed or power."></span>
85
  </div>
86
+
87
+ <!-- API Key Input -->
88
+ <div class="relative">
89
+ <label for="apiKey" class="block text-gray-700 font-semibold mb-2">SambaNava API Key (optional):</label>
90
+ <input type="password" id="apiKey" placeholder="Enter your API Key" class="w-full p-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-teal-500">
91
+ <span class="tooltip" data-tippy-content="Use SambaNova API key for enhanced speed. You can obtain a free key from <a href='https://cloud.sambanova.ai/apis' class='text-teal-400 underline' target='_blank'>https://cloud.sambanova.ai/apis</a>."></span>
92
  </div>
93
  </div>
94
+
95
+ <!-- Transcript Section -->
96
+ <div id="transcript" class="mt-8 bg-gray-100 rounded-lg p-4 h-48 overflow-y-auto text-sm font-mono shadow-inner">
97
+ <!-- Transcript content will appear here -->
 
 
98
  </div>
99
+
100
  </div>
101
+
102
+ <!-- Custom Script -->
103
  <script>
104
+ // Load appropriate script based on browser and device
105
  function loadScript() {
106
+ const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor) && !/Edg/.test(navigator.userAgent);
107
+ const isDesktop = window.innerWidth > 768;
108
+ let scriptSrc;
109
+
 
 
 
 
110
  if (isChrome && isDesktop) {
111
+ scriptSrc = 'script1.js';
112
  } else {
113
+ scriptSrc = 'script2.js';
114
+ }
115
+
116
+ const existingScript = document.querySelector('script[data-custom="true"]');
117
+ if (existingScript) {
118
+ existingScript.remove();
119
  }
120
+
121
+ const script = document.createElement('script');
122
+ script.src = scriptSrc;
123
+ script.async = true;
124
+ script.setAttribute('data-custom', 'true');
125
+ script.onerror = () => console.error('Error loading script:', scriptSrc);
126
+ document.body.appendChild(script);
127
  }
128
+
129
+ document.addEventListener('DOMContentLoaded', () => {
130
+ loadScript();
131
+
132
+ // Initialize Tippy.js tooltips
133
+ tippy('.tooltip', {
134
+ allowHTML: true,
135
+ theme: 'light-border',
136
+ placement: 'top',
137
+ });
138
+ });
139
  </script>
140
  </body>
141
  </html>