Spaces:
Running
Running
Update index.html
Browse files- 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 |
-
|
8 |
-
<link href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
|
9 |
-
|
10 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
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-
|
72 |
-
<div class="
|
73 |
-
<h1 class="text-
|
74 |
-
<div id="responseTime" class="text-gray-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
<span>User: Idle</span>
|
79 |
</div>
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
<span>AI: Idle</span>
|
83 |
</div>
|
84 |
</div>
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
Start Listening
|
88 |
</button>
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
93 |
<option value="Amy">Female</option>
|
94 |
<option value="Brian">Male</option>
|
95 |
</select>
|
96 |
-
<span class="tooltip
|
97 |
</div>
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
101 |
<option value="8b">Fastest</option>
|
102 |
<option value="70b">Powerful</option>
|
103 |
</select>
|
104 |
-
<span class="tooltip
|
105 |
</div>
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
<
|
|
|
|
|
110 |
</div>
|
111 |
</div>
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
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 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
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 |
-
|
133 |
} else {
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
140 |
}
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|