Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +313 -19
- prompts.txt +0 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: gemini-chat
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,313 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>JP Gemini Chat</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
/* Custom scrollbar */
|
| 11 |
+
::-webkit-scrollbar {
|
| 12 |
+
width: 8px;
|
| 13 |
+
}
|
| 14 |
+
::-webkit-scrollbar-track {
|
| 15 |
+
background: #f1f1f1;
|
| 16 |
+
border-radius: 10px;
|
| 17 |
+
}
|
| 18 |
+
::-webkit-scrollbar-thumb {
|
| 19 |
+
background: #888;
|
| 20 |
+
border-radius: 10px;
|
| 21 |
+
}
|
| 22 |
+
::-webkit-scrollbar-thumb:hover {
|
| 23 |
+
background: #555;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
/* Chat bubble animation */
|
| 27 |
+
@keyframes fadeIn {
|
| 28 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 29 |
+
to { opacity: 1; transform: translateY(0); }
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.message {
|
| 33 |
+
animation: fadeIn 0.3s ease-out;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/* Loading dots */
|
| 37 |
+
@keyframes blink {
|
| 38 |
+
0% { opacity: 0.2; }
|
| 39 |
+
20% { opacity: 1; }
|
| 40 |
+
100% { opacity: 0.2; }
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.loading-dots span {
|
| 44 |
+
animation-name: blink;
|
| 45 |
+
animation-duration: 1.4s;
|
| 46 |
+
animation-iteration-count: infinite;
|
| 47 |
+
animation-fill-mode: both;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.loading-dots span:nth-child(2) {
|
| 51 |
+
animation-delay: 0.2s;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.loading-dots span:nth-child(3) {
|
| 55 |
+
animation-delay: 0.4s;
|
| 56 |
+
}
|
| 57 |
+
</style>
|
| 58 |
+
</head>
|
| 59 |
+
<body class="bg-gray-100 font-sans antialiased">
|
| 60 |
+
<div class="flex flex-col h-screen">
|
| 61 |
+
<!-- Header -->
|
| 62 |
+
<header class="bg-indigo-600 text-white shadow-md">
|
| 63 |
+
<div class="container mx-auto px-4 py-4 flex items-center justify-between">
|
| 64 |
+
<div class="flex items-center space-x-3">
|
| 65 |
+
<i class="fas fa-robot text-2xl"></i>
|
| 66 |
+
<h1 class="text-xl font-bold">JP Gemini Chat</h1>
|
| 67 |
+
</div>
|
| 68 |
+
<div class="flex items-center space-x-4">
|
| 69 |
+
<button id="clearChat" class="flex items-center space-x-1 bg-indigo-700 hover:bg-indigo-800 px-3 py-1 rounded-md transition">
|
| 70 |
+
<i class="fas fa-trash-alt"></i>
|
| 71 |
+
<span>Clear</span>
|
| 72 |
+
</button>
|
| 73 |
+
<button id="toggleTheme" class="flex items-center space-x-1 bg-indigo-700 hover:bg-indigo-800 px-3 py-1 rounded-md transition">
|
| 74 |
+
<i class="fas fa-moon"></i>
|
| 75 |
+
<span>Dark</span>
|
| 76 |
+
</button>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
</header>
|
| 80 |
+
|
| 81 |
+
<!-- Chat container -->
|
| 82 |
+
<div class="flex-1 overflow-hidden container mx-auto px-4 py-4 flex flex-col">
|
| 83 |
+
<div id="chatContainer" class="flex-1 overflow-y-auto mb-4 space-y-4 p-2 rounded-lg bg-white shadow-inner">
|
| 84 |
+
<!-- Welcome message -->
|
| 85 |
+
<div class="message flex">
|
| 86 |
+
<div class="flex-shrink-0 mr-3">
|
| 87 |
+
<div class="w-8 h-8 rounded-full bg-indigo-500 flex items-center justify-center text-white">
|
| 88 |
+
<i class="fas fa-robot"></i>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
<div class="bg-indigo-100 rounded-lg p-3 max-w-3xl">
|
| 92 |
+
<p class="text-gray-800">Hello! I'm JP Gemini. How can I assist you today?</p>
|
| 93 |
+
</div>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
|
| 97 |
+
<!-- Input area -->
|
| 98 |
+
<div class="bg-white rounded-lg shadow-lg p-4">
|
| 99 |
+
<div class="flex items-center space-x-2">
|
| 100 |
+
<textarea id="userInput"
|
| 101 |
+
class="flex-1 border border-gray-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 resize-none"
|
| 102 |
+
rows="2"
|
| 103 |
+
placeholder="Type your message here..."></textarea>
|
| 104 |
+
<button id="sendButton"
|
| 105 |
+
class="bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg px-4 py-2 transition flex items-center justify-center h-12 w-12">
|
| 106 |
+
<i class="fas fa-paper-plane"></i>
|
| 107 |
+
</button>
|
| 108 |
+
</div>
|
| 109 |
+
<div class="mt-2 flex items-center justify-between text-sm text-gray-500">
|
| 110 |
+
<div>
|
| 111 |
+
<span id="charCount">0</span>/1000
|
| 112 |
+
</div>
|
| 113 |
+
<div class="flex space-x-2">
|
| 114 |
+
<button id="voiceInput" class="hover:text-indigo-600 transition">
|
| 115 |
+
<i class="fas fa-microphone"></i>
|
| 116 |
+
</button>
|
| 117 |
+
<button id="attachFile" class="hover:text-indigo-600 transition">
|
| 118 |
+
<i class="fas fa-paperclip"></i>
|
| 119 |
+
</button>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<script>
|
| 127 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 128 |
+
const chatContainer = document.getElementById('chatContainer');
|
| 129 |
+
const userInput = document.getElementById('userInput');
|
| 130 |
+
const sendButton = document.getElementById('sendButton');
|
| 131 |
+
const clearChat = document.getElementById('clearChat');
|
| 132 |
+
const toggleTheme = document.getElementById('toggleTheme');
|
| 133 |
+
const charCount = document.getElementById('charCount');
|
| 134 |
+
const voiceInput = document.getElementById('voiceInput');
|
| 135 |
+
const attachFile = document.getElementById('attachFile');
|
| 136 |
+
|
| 137 |
+
let isDarkMode = false;
|
| 138 |
+
|
| 139 |
+
// Character counter
|
| 140 |
+
userInput.addEventListener('input', function() {
|
| 141 |
+
const count = this.value.length;
|
| 142 |
+
charCount.textContent = count;
|
| 143 |
+
|
| 144 |
+
if (count > 1000) {
|
| 145 |
+
charCount.classList.add('text-red-500');
|
| 146 |
+
} else {
|
| 147 |
+
charCount.classList.remove('text-red-500');
|
| 148 |
+
}
|
| 149 |
+
});
|
| 150 |
+
|
| 151 |
+
// Send message on Enter (Shift+Enter for new line)
|
| 152 |
+
userInput.addEventListener('keydown', function(e) {
|
| 153 |
+
if (e.key === 'Enter' && !e.shiftKey) {
|
| 154 |
+
e.preventDefault();
|
| 155 |
+
sendMessage();
|
| 156 |
+
}
|
| 157 |
+
});
|
| 158 |
+
|
| 159 |
+
// Send message on button click
|
| 160 |
+
sendButton.addEventListener('click', sendMessage);
|
| 161 |
+
|
| 162 |
+
// Clear chat
|
| 163 |
+
clearChat.addEventListener('click', function() {
|
| 164 |
+
chatContainer.innerHTML = `
|
| 165 |
+
<div class="message flex">
|
| 166 |
+
<div class="flex-shrink-0 mr-3">
|
| 167 |
+
<div class="w-8 h-8 rounded-full bg-indigo-500 flex items-center justify-center text-white">
|
| 168 |
+
<i class="fas fa-robot"></i>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
<div class="bg-indigo-100 rounded-lg p-3 max-w-3xl">
|
| 172 |
+
<p class="text-gray-800">Hello! I'm JP Gemini. How can I assist you today?</p>
|
| 173 |
+
</div>
|
| 174 |
+
</div>
|
| 175 |
+
`;
|
| 176 |
+
});
|
| 177 |
+
|
| 178 |
+
// Toggle theme
|
| 179 |
+
toggleTheme.addEventListener('click', function() {
|
| 180 |
+
isDarkMode = !isDarkMode;
|
| 181 |
+
if (isDarkMode) {
|
| 182 |
+
document.body.classList.add('bg-gray-900');
|
| 183 |
+
document.body.classList.remove('bg-gray-100');
|
| 184 |
+
chatContainer.classList.add('bg-gray-800');
|
| 185 |
+
chatContainer.classList.remove('bg-white');
|
| 186 |
+
document.querySelector('.bg-white').classList.add('bg-gray-700', 'text-white');
|
| 187 |
+
document.querySelector('.bg-white').classList.remove('bg-white');
|
| 188 |
+
toggleTheme.innerHTML = '<i class="fas fa-sun"></i><span>Light</span>';
|
| 189 |
+
} else {
|
| 190 |
+
document.body.classList.add('bg-gray-100');
|
| 191 |
+
document.body.classList.remove('bg-gray-900');
|
| 192 |
+
chatContainer.classList.add('bg-white');
|
| 193 |
+
chatContainer.classList.remove('bg-gray-800');
|
| 194 |
+
document.querySelector('.bg-gray-700').classList.add('bg-white');
|
| 195 |
+
document.querySelector('.bg-gray-700').classList.remove('bg-gray-700', 'text-white');
|
| 196 |
+
toggleTheme.innerHTML = '<i class="fas fa-moon"></i><span>Dark</span>';
|
| 197 |
+
}
|
| 198 |
+
});
|
| 199 |
+
|
| 200 |
+
// Voice input (placeholder)
|
| 201 |
+
voiceInput.addEventListener('click', function() {
|
| 202 |
+
alert('Voice input feature would be implemented here');
|
| 203 |
+
});
|
| 204 |
+
|
| 205 |
+
// Attach file (placeholder)
|
| 206 |
+
attachFile.addEventListener('click', function() {
|
| 207 |
+
alert('File attachment feature would be implemented here');
|
| 208 |
+
});
|
| 209 |
+
|
| 210 |
+
function sendMessage() {
|
| 211 |
+
const message = userInput.value.trim();
|
| 212 |
+
if (message === '') return;
|
| 213 |
+
|
| 214 |
+
// Add user message to chat
|
| 215 |
+
addMessageToChat(message, 'user');
|
| 216 |
+
userInput.value = '';
|
| 217 |
+
charCount.textContent = '0';
|
| 218 |
+
|
| 219 |
+
// Show loading indicator
|
| 220 |
+
const loadingId = showLoadingIndicator();
|
| 221 |
+
|
| 222 |
+
// Simulate API response after delay
|
| 223 |
+
setTimeout(() => {
|
| 224 |
+
// Remove loading indicator
|
| 225 |
+
removeLoadingIndicator(loadingId);
|
| 226 |
+
|
| 227 |
+
// Add bot response
|
| 228 |
+
const responses = [
|
| 229 |
+
"I understand your question. Let me think about that...",
|
| 230 |
+
"That's an interesting point. Here's what I think...",
|
| 231 |
+
"Thanks for your message. Here's my response...",
|
| 232 |
+
"I've analyzed your input and here's my perspective..."
|
| 233 |
+
];
|
| 234 |
+
const randomResponse = responses[Math.floor(Math.random() * responses.length)];
|
| 235 |
+
addMessageToChat(randomResponse, 'bot');
|
| 236 |
+
}, 1500);
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
function addMessageToChat(message, sender) {
|
| 240 |
+
const messageDiv = document.createElement('div');
|
| 241 |
+
messageDiv.className = 'message flex';
|
| 242 |
+
|
| 243 |
+
if (sender === 'user') {
|
| 244 |
+
messageDiv.innerHTML = `
|
| 245 |
+
<div class="flex-1 flex justify-end">
|
| 246 |
+
<div class="flex flex-row-reverse items-start max-w-3xl">
|
| 247 |
+
<div class="flex-shrink-0 ml-3">
|
| 248 |
+
<div class="w-8 h-8 rounded-full bg-gray-300 flex items-center justify-center">
|
| 249 |
+
<i class="fas fa-user text-gray-600"></i>
|
| 250 |
+
</div>
|
| 251 |
+
</div>
|
| 252 |
+
<div class="bg-indigo-500 text-white rounded-lg p-3">
|
| 253 |
+
<p>${message}</p>
|
| 254 |
+
</div>
|
| 255 |
+
</div>
|
| 256 |
+
</div>
|
| 257 |
+
`;
|
| 258 |
+
} else {
|
| 259 |
+
messageDiv.innerHTML = `
|
| 260 |
+
<div class="flex items-start">
|
| 261 |
+
<div class="flex-shrink-0 mr-3">
|
| 262 |
+
<div class="w-8 h-8 rounded-full bg-indigo-500 flex items-center justify-center text-white">
|
| 263 |
+
<i class="fas fa-robot"></i>
|
| 264 |
+
</div>
|
| 265 |
+
</div>
|
| 266 |
+
<div class="bg-indigo-100 rounded-lg p-3 max-w-3xl">
|
| 267 |
+
<p class="text-gray-800">${message}</p>
|
| 268 |
+
</div>
|
| 269 |
+
</div>
|
| 270 |
+
`;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
chatContainer.appendChild(messageDiv);
|
| 274 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
function showLoadingIndicator() {
|
| 278 |
+
const loadingId = 'loading-' + Date.now();
|
| 279 |
+
const loadingDiv = document.createElement('div');
|
| 280 |
+
loadingDiv.id = loadingId;
|
| 281 |
+
loadingDiv.className = 'message flex';
|
| 282 |
+
loadingDiv.innerHTML = `
|
| 283 |
+
<div class="flex items-start">
|
| 284 |
+
<div class="flex-shrink-0 mr-3">
|
| 285 |
+
<div class="w-8 h-8 rounded-full bg-indigo-500 flex items-center justify-center text-white">
|
| 286 |
+
<i class="fas fa-robot"></i>
|
| 287 |
+
</div>
|
| 288 |
+
</div>
|
| 289 |
+
<div class="bg-indigo-100 rounded-lg p-3 max-w-3xl">
|
| 290 |
+
<div class="loading-dots flex space-x-1">
|
| 291 |
+
<span class="inline-block w-2 h-2 rounded-full bg-gray-600"></span>
|
| 292 |
+
<span class="inline-block w-2 h-2 rounded-full bg-gray-600"></span>
|
| 293 |
+
<span class="inline-block w-2 h-2 rounded-full bg-gray-600"></span>
|
| 294 |
+
</div>
|
| 295 |
+
</div>
|
| 296 |
+
</div>
|
| 297 |
+
`;
|
| 298 |
+
|
| 299 |
+
chatContainer.appendChild(loadingDiv);
|
| 300 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 301 |
+
return loadingId;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
function removeLoadingIndicator(id) {
|
| 305 |
+
const element = document.getElementById(id);
|
| 306 |
+
if (element) {
|
| 307 |
+
element.remove();
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
});
|
| 311 |
+
</script>
|
| 312 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=strecon/gemini-chat" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 313 |
+
</html>
|
prompts.txt
ADDED
|
File without changes
|