Spaces:
Running
Running
Update index.html
Browse files- index.html +107 -77
index.html
CHANGED
@@ -4,87 +4,117 @@
|
|
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=
|
8 |
-
<
|
|
|
|
|
9 |
<script src="https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js"></script>
|
10 |
-
<
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
</head>
|
25 |
-
<body class="bg-
|
26 |
-
<div class="container
|
27 |
-
<
|
28 |
-
|
29 |
-
|
30 |
-
<div class="
|
31 |
-
|
32 |
-
|
33 |
-
<div class="bg-primary text-white px-4 py-2 rounded-full flex items-center" id="userIndicator">
|
34 |
-
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
|
35 |
-
<span>User: Idle</span>
|
36 |
-
</div>
|
37 |
-
<div class="bg-secondary text-white px-4 py-2 rounded-full flex items-center" id="aiIndicator">
|
38 |
-
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"></path></svg>
|
39 |
-
<span>AI: Idle</span>
|
40 |
-
</div>
|
41 |
</div>
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
class="bg-accent hover:bg-accent-dark text-white font-bold py-3 px-6 rounded-full transition duration-300 ease-in-out transform hover:-translate-y-1 hover:shadow-lg flex items-center justify-center mx-auto mb-6"
|
46 |
-
@click="isListening = !isListening"
|
47 |
-
:class="{ 'bg-red-500 hover:bg-red-600': isListening }"
|
48 |
-
>
|
49 |
-
<svg class="w-6 h-6 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"></path></svg>
|
50 |
-
<span x-text="isListening ? 'Stop Listening' : 'Start Listening'"></span>
|
51 |
-
</button>
|
52 |
-
|
53 |
-
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
|
54 |
-
<div class="relative">
|
55 |
-
<label for="voiceSelect" class="block text-sm font-medium text-gray-700 mb-1">Voice:</label>
|
56 |
-
<select id="voiceSelect" class="block w-full bg-white border border-gray-300 rounded-md py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary">
|
57 |
-
<option value="Amy">Female</option>
|
58 |
-
<option value="Brian">Male</option>
|
59 |
-
</select>
|
60 |
-
<div class="absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none">
|
61 |
-
<svg class="w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
|
62 |
-
</div>
|
63 |
-
</div>
|
64 |
-
<div class="relative">
|
65 |
-
<label for="modelSelect" class="block text-sm font-medium text-gray-700 mb-1">Model:</label>
|
66 |
-
<select id="modelSelect" class="block w-full bg-white border border-gray-300 rounded-md py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary">
|
67 |
-
<option value="8b">Fastest</option>
|
68 |
-
<option value="70b">Powerful</option>
|
69 |
-
</select>
|
70 |
-
<div class="absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none">
|
71 |
-
<svg class="w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
|
72 |
-
</div>
|
73 |
-
</div>
|
74 |
-
<div>
|
75 |
-
<label for="apiKey" class="block text-sm font-medium text-gray-700 mb-1">SambaNava API Key:</label>
|
76 |
-
<input type="password" id="apiKey" placeholder="Enter your API Key" class="block w-full bg-white border border-gray-300 rounded-md py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary">
|
77 |
-
</div>
|
78 |
</div>
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
87 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
</div>
|
89 |
</div>
|
90 |
|
@@ -97,7 +127,7 @@
|
|
97 |
existingScript.remove();
|
98 |
}
|
99 |
var script = document.createElement('script');
|
100 |
-
script.type = 'module';
|
101 |
if (isChrome && isDesktop) {
|
102 |
script.src = 'script1.js';
|
103 |
} else {
|
|
|
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 |
|
|
|
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 {
|