RootDeveloperDS commited on
Commit
40cf838
·
verified ·
1 Parent(s): 1a22ca5

undefined - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +273 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Visar Agent 0 1
3
- emoji: 🌍
4
  colorFrom: red
5
- colorTo: indigo
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: visar-agent-0-1
3
+ emoji: 🐳
4
  colorFrom: red
5
+ colorTo: yellow
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,273 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>VISAR Agent 0.1</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
+ <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap" rel="stylesheet">
10
+ <script>
11
+ tailwind.config = {
12
+ theme: {
13
+ extend: {
14
+ colors: {
15
+ primary: '#f04a29',
16
+ secondary: '#2F4F4F',
17
+ accent: '#d932bd',
18
+ },
19
+ fontFamily: {
20
+ sans: ['Space Grotesk', 'sans-serif'],
21
+ },
22
+ animation: {
23
+ 'pulse-glow': 'pulse-glow 2s infinite',
24
+ },
25
+ keyframes: {
26
+ 'pulse-glow': {
27
+ '0%, 100%': { 'box-shadow': '0 0 5px #f04a29' },
28
+ '50%': { 'box-shadow': '0 0 20px #f04a29' },
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
34
+ </script>
35
+ <style>
36
+ .glow-effect {
37
+ transition: all 0.3s ease;
38
+ }
39
+ .glow-effect:hover {
40
+ box-shadow: 0 0 15px #d932bd;
41
+ }
42
+ .neon-text {
43
+ text-shadow: 0 0 5px #f04a29, 0 0 10px #f04a29;
44
+ }
45
+ .code-block {
46
+ background-color: #1a2a2a;
47
+ border-left: 3px solid #f04a29;
48
+ }
49
+ .language-selector {
50
+ background-color: #2F4F4F;
51
+ border: 1px solid #f04a29;
52
+ }
53
+ .language-selector:hover {
54
+ background-color: #3a5f5f;
55
+ }
56
+ .loading-dots::after {
57
+ content: '.';
58
+ animation: dots 1.5s steps(5, end) infinite;
59
+ }
60
+ @keyframes dots {
61
+ 0%, 20% { content: '.'; }
62
+ 40% { content: '..'; }
63
+ 60% { content: '...'; }
64
+ 80%, 100% { content: ''; }
65
+ }
66
+ </style>
67
+ </head>
68
+ <body class="bg-secondary font-sans text-white min-h-screen flex flex-col">
69
+ <div class="container mx-auto p-4 max-w-md">
70
+ <!-- Header -->
71
+ <header class="mb-6 text-center">
72
+ <h1 class="text-2xl font-bold neon-text mb-2">VISAR Agent 0.1</h1>
73
+ <p class="text-accent text-sm">Your AI coding assistant</p>
74
+ </header>
75
+
76
+ <!-- Main Content -->
77
+ <main class="flex-1">
78
+ <!-- API Key Input -->
79
+ <div class="mb-4 bg-gray-800 p-3 rounded-lg">
80
+ <label for="apiKey" class="block text-sm font-medium mb-1">Gemini API Key</label>
81
+ <div class="flex">
82
+ <input type="password" id="apiKey" placeholder="Enter your API key"
83
+ class="flex-1 bg-gray-700 border border-gray-600 rounded-l px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent">
84
+ <button id="saveKeyBtn" class="bg-primary hover:bg-opacity-90 px-3 py-2 rounded-r text-sm glow-effect">
85
+ <i class="fas fa-save"></i>
86
+ </button>
87
+ </div>
88
+ <p class="text-xs mt-1 text-gray-400">Or pass via URL: ?key=YOUR_API_KEY</p>
89
+ </div>
90
+
91
+ <!-- Language Selector -->
92
+ <div class="mb-4">
93
+ <label for="language" class="block text-sm font-medium mb-1">Programming Language</label>
94
+ <select id="language" class="w-full language-selector rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent">
95
+ <option value="python">Python</option>
96
+ <option value="javascript">JavaScript</option>
97
+ <option value="java">Java</option>
98
+ <option value="csharp">C#</option>
99
+ <option value="cpp">C++</option>
100
+ <option value="php">PHP</option>
101
+ <option value="ruby">Ruby</option>
102
+ <option value="swift">Swift</option>
103
+ <option value="go">Go</option>
104
+ <option value="rust">Rust</option>
105
+ </select>
106
+ </div>
107
+
108
+ <!-- Query Input -->
109
+ <div class="mb-4">
110
+ <label for="query" class="block text-sm font-medium mb-1">What do you need?</label>
111
+ <textarea id="query" rows="3" placeholder="Describe the code you want to generate..."
112
+ class="w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent"></textarea>
113
+ </div>
114
+
115
+ <!-- Generate Button -->
116
+ <button id="generateBtn" class="w-full bg-accent hover:bg-opacity-90 py-2 px-4 rounded font-medium mb-4 glow-effect animate-pulse-glow">
117
+ <i class="fas fa-bolt mr-2"></i> Generate Code
118
+ </button>
119
+
120
+ <!-- Result Area -->
121
+ <div class="mb-4">
122
+ <div class="flex justify-between items-center mb-1">
123
+ <label class="text-sm font-medium">Generated Code</label>
124
+ <button id="copyBtn" class="text-xs bg-gray-700 hover:bg-gray-600 px-2 py-1 rounded glow-effect" disabled>
125
+ <i class="fas fa-copy mr-1"></i> Copy
126
+ </button>
127
+ </div>
128
+ <div id="result" class="code-block p-3 rounded text-sm overflow-auto max-h-60">
129
+ <p class="text-gray-400">Your generated code will appear here...</p>
130
+ </div>
131
+ <div id="loading" class="hidden text-center py-4 text-accent">
132
+ <p>Generating<span class="loading-dots"></span></p>
133
+ </div>
134
+ </div>
135
+ </main>
136
+
137
+ <!-- Footer -->
138
+ <footer class="text-center text-xs text-gray-400 mt-6">
139
+ <p>Powered by Gemini AI</p>
140
+ <p class="mt-1">VISAR Agent 0.1</p>
141
+ </footer>
142
+ </div>
143
+
144
+ <script>
145
+ document.addEventListener('DOMContentLoaded', function() {
146
+ // Check for API key in URL
147
+ const urlParams = new URLSearchParams(window.location.search);
148
+ const apiKeyFromUrl = urlParams.get('key');
149
+
150
+ if (apiKeyFromUrl) {
151
+ document.getElementById('apiKey').value = apiKeyFromUrl;
152
+ localStorage.setItem('geminiApiKey', apiKeyFromUrl);
153
+ } else {
154
+ // Load saved API key from localStorage
155
+ const savedKey = localStorage.getItem('geminiApiKey');
156
+ if (savedKey) {
157
+ document.getElementById('apiKey').value = savedKey;
158
+ }
159
+ }
160
+
161
+ // Save API key button
162
+ document.getElementById('saveKeyBtn').addEventListener('click', function() {
163
+ const apiKey = document.getElementById('apiKey').value;
164
+ if (apiKey) {
165
+ localStorage.setItem('geminiApiKey', apiKey);
166
+ alert('API key saved!');
167
+ } else {
168
+ alert('Please enter an API key');
169
+ }
170
+ });
171
+
172
+ // Generate button
173
+ document.getElementById('generateBtn').addEventListener('click', function() {
174
+ const apiKey = document.getElementById('apiKey').value;
175
+ const language = document.getElementById('language').value;
176
+ const query = document.getElementById('query').value;
177
+
178
+ if (!apiKey) {
179
+ alert('Please enter your Gemini API key');
180
+ return;
181
+ }
182
+
183
+ if (!query) {
184
+ alert('Please describe what code you want to generate');
185
+ return;
186
+ }
187
+
188
+ generateCode(apiKey, language, query);
189
+ });
190
+
191
+ // Copy button
192
+ document.getElementById('copyBtn').addEventListener('click', function() {
193
+ const codeElement = document.getElementById('result').querySelector('code');
194
+ if (codeElement) {
195
+ navigator.clipboard.writeText(codeElement.textContent)
196
+ .then(() => {
197
+ const copyBtn = document.getElementById('copyBtn');
198
+ copyBtn.innerHTML = '<i class="fas fa-check mr-1"></i> Copied!';
199
+ setTimeout(() => {
200
+ copyBtn.innerHTML = '<i class="fas fa-copy mr-1"></i> Copy';
201
+ }, 2000);
202
+ })
203
+ .catch(err => {
204
+ console.error('Failed to copy: ', err);
205
+ });
206
+ }
207
+ });
208
+
209
+ // Function to generate code (mock implementation - in a real app, you'd call the Gemini API)
210
+ function generateCode(apiKey, language, query) {
211
+ const resultDiv = document.getElementById('result');
212
+ const loadingDiv = document.getElementById('loading');
213
+ const copyBtn = document.getElementById('copyBtn');
214
+
215
+ // Show loading state
216
+ resultDiv.classList.add('hidden');
217
+ loadingDiv.classList.remove('hidden');
218
+ copyBtn.disabled = true;
219
+
220
+ // Simulate API call delay
221
+ setTimeout(() => {
222
+ // Hide loading state
223
+ loadingDiv.classList.add('hidden');
224
+ resultDiv.classList.remove('hidden');
225
+
226
+ // Mock response - in a real app, this would be the actual API response
227
+ const mockResponses = {
228
+ python: `# ${query}\ndef solution():\n # Your code here\n return "Hello, World!"`,
229
+ javascript: `// ${query}\nfunction solution() {\n // Your code here\n return "Hello, World!";\n}`,
230
+ java: `// ${query}\npublic class Solution {\n public static void main(String[] args) {\n // Your code here\n System.out.println("Hello, World!");\n }\n}`,
231
+ csharp: `// ${query}\nusing System;\n\nclass Program {\n static void Main() {\n // Your code here\n Console.WriteLine("Hello, World!");\n }\n}`,
232
+ cpp: `// ${query}\n#include <iostream>\n\nint main() {\n // Your code here\n std::cout << "Hello, World!";\n return 0;\n}`,
233
+ php: `<?php\n// ${query}\nfunction solution() {\n // Your code here\n return "Hello, World!";\n}\n?>`,
234
+ ruby: `# ${query}\ndef solution\n # Your code here\n "Hello, World!"\nend`,
235
+ swift: `// ${query\nfunc solution() -> String {\n // Your code here\n return "Hello, World!"\n}`,
236
+ go: `// ${query}\npackage main\n\nimport "fmt"\n\nfunc main() {\n // Your code here\n fmt.Println("Hello, World!")\n}`,
237
+ rust: `// ${query}\nfn main() {\n // Your code here\n println!("Hello, World!");\n}`
238
+ };
239
+
240
+ const code = mockResponses[language] || mockResponses['python'];
241
+ resultDiv.innerHTML = `<pre><code class="language-${language}">${code}</code></pre>`;
242
+ copyBtn.disabled = false;
243
+
244
+ // Add syntax highlighting (in a real app, you might use a library like Prism.js)
245
+ resultDiv.querySelector('code').style.color = '#f8f8f2';
246
+ }, 1500);
247
+ }
248
+
249
+ // In a real implementation, you would have a function to call the actual Gemini API
250
+ // async function callGeminiAPI(apiKey, prompt) {
251
+ // const response = await fetch('https://api.gemini.ai/v1/generate', {
252
+ // method: 'POST',
253
+ // headers: {
254
+ // 'Content-Type': 'application/json',
255
+ // 'Authorization': `Bearer ${apiKey}`
256
+ // },
257
+ // body: JSON.stringify({
258
+ // prompt: prompt,
259
+ // max_tokens: 1000,
260
+ // temperature: 0.7
261
+ // })
262
+ // });
263
+ //
264
+ // if (!response.ok) {
265
+ // throw new Error('API request failed');
266
+ // }
267
+ //
268
+ // return await response.json();
269
+ // }
270
+ });
271
+ </script>
272
+ <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=RootDeveloperDS/visar-agent-0-1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
273
+ </html>