Spaces:
Running
Running
intergrate all neccessary api for it too work
Browse files7 unmodified lines89101112131114151617260 unmodified lines27827928028127828228328428128528628328728828928629029128829229329429129529629329729829929630030129830230330430130530630330730830931074 unmodified lines3853863873883893903913923843933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304313863873883894324334344354364374384394403963973983994004014414424434444454464474484494034044054064074084094104504514524534544554564574584594604124134144154164174184194204614624634644654664674684694704714724734744754764774784794804814824224834244844854864874 unmodified lines4924934944954964974984995005015025035045054365065075087 unmodified lines <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/qiskit.js@latest/dist/qiskit.js"></script> <script src="https://cdn.jsdelivr.net/npm/country-flag-emoji-json@1.0.2/dist/by-code.json"></script> <style><style> @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap'); :root {260 unmodified lines <h2 class="text-xl font-semibold gradient-text mb-6">Global Quantum Network</h2> <div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4"> <!-- These will be populated by JavaScript --> <div class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div id="country-node-us" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div class="text-3xl mb-2">🇺🇸</div> <div class="font-medium">United States</div> <div class="text-sm text-gray-400">2,145 nodes</div> <div class="text-sm text-gray-400"><span class="node-count">2,145</span> nodes</div> </div> <div class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div id="country-node-in" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div class="text-3xl mb-2">🇮🇳</div> <div class="font-medium">India</div> <div class="text-sm text-gray-400">1,876 nodes</div> <div class="text-sm text-gray-400"><span class="node-count">1,876</span> nodes</div> </div> <div class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div id="country-node-de" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div class="text-3xl mb-2">🇩🇪</div> <div class="font-medium">Germany</div> <div class="text-sm text-gray-400">943 nodes</div> <div class="text-sm text-gray-400"><span class="node-count">943</span> nodes</div> </div> <div class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div id="country-node-br" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div class="text-3xl mb-2">🇧🇷</div> <div class="font-medium">Brazil</div> <div class="text-sm text-gray-400">782 nodes</div> <div class="text-sm text-gray-400"><span class="node-count">782</span> nodes</div> </div> <div class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div id="country-node-jp" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> <div class="text-3xl mb-2">🇯🇵</div> <div class="font-medium">Japan</div> <div class="text-sm text-gray-400">654 nodes</div> <div class="text-sm text-gray-400"><span class="node-count">654</span> nodes</div> </div> </div></div> </div> </section> </main>74 unmodified lines container.appendChild(particle); } } // Quantum Circuit Execution API async function executeQuantumCircuit(code) { try { // Use Qiskit.js for quantum simulation const circuit = new qiskit.QuantumCircuit(1); // Simple Hadamard gate for superposition circuit.h(0); const result = await circuit.run(); // Get random greeting based on measurement const greeting = await getRandomGreeting(result.measurements[0]); // Get country data from IP const countryData = await axios.get('https://ipapi.co/json/'); return { greeting, country: countryData.data.country_name, flag: countryData.data.country_code }; } catch (error) { console.error("Quantum execution error:", error); return { error: "Quantum decoherence detected" }; } }
// Get random greeting from API async function getRandomGreeting(measurement) { const greetings = { 0: ["Hello", "Hola", "Bonjour"], 1: ["नमस्ते", "こんにちは", "你好"] }; const index = Math.floor(Math.random() * greetings[measurement].length); return greetings[measurement][index]; }
// Get online users count async function getOnlineUsers() { const response = await axios.get('https://quantum-network.glitch.me/stats'); return response.data; }
// Simulate quantum execution function simulateExecution() { const output = document.querySelector('.output-container'); const greetings = ["Hello", "Hola", "Bonjour", "नमस्ते", "こんにちは", "你好", "مرحبا", "Привет"]; const countries = ["United States", "India", "France", "Japan", "China", "Egypt", "Russia", "Brazil"]; async function simulateExecution() { const output = document.querySelector('.bg-gray-900'); const code = document.querySelector('textarea').value; // Clear previous output except initial messages while (output.children.length > 5) { output.removeChild(output.lastChild); } // Add new output lines setTimeout(() => { const line1 = document.createElement('div'); line1.className = 'output-line info'; line1.textContent = 'Observing quantum state...'; output.appendChild(line1); // Add loading state const loadingLine = document.createElement('div'); loadingLine.className = 'output-line info'; loadingLine.textContent = 'Executing quantum circuit...'; output.appendChild(loadingLine); try { const result = await executeQuantumCircuit(code); setTimeout(() => { const greeting = greetings[Math.floor(Math.random() * greetings.length)]; const country = countries[Math.floor(Math.random() * countries.length)]; const line2 = document.createElement('div'); line2.className = 'output-line success'; line2.textContent = `Quantum Greeting: ${greeting}`; output.appendChild(line2); if (result.error) { const errorLine = document.createElement('div'); errorLine.className = 'output-line error'; errorLine.textContent = result.error; output.appendChild(errorLine); } else { const greetingLine = document.createElement('div'); greetingLine.className = 'output-line success'; greetingLine.textContent = `Quantum Greeting: ${result.greeting}`; output.appendChild(greetingLine); const line3 = document.createElement('div'); line3.className = 'output-line success'; line3.textContent = `Data entangled with network from ${country}`; output.appendChild(line3); // Scroll to bottom output.scrollTop = output.scrollHeight; }, 800); }, 500); const countryLine = document.createElement('div'); countryLine.className = 'output-line success'; countryLine.textContent = `Data entangled with ${result.country} (${result.flag})`; output.appendChild(countryLine); } // Update network stats const stats = await getOnlineUsers(); document.querySelectorAll('.font-medium')[0].textContent = stats.onlineUsers.toLocaleString(); document.querySelectorAll('.font-medium')[1].textContent = stats.countries; document.querySelectorAll('.font-medium')[2].textContent = stats.circuits.toLocaleString(); } catch (error) { const errorLine = document.createElement('div'); errorLine.className = 'output-line error'; errorLine.textContent = `Quantum error: ${error.message}`; output.appendChild(errorLine); } // Scroll to bottom output.scrollTop = output.scrollHeight; } // Initialize document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', async () => { feather.replace(); createParticles(); 4 unmodified lines document.querySelector('.md\\:hidden').addEventListener('click', () => { document.querySelector('aside').classList.toggle('hidden'); });
// Load initial stats try { const stats = await getOnlineUsers(); document.querySelectorAll('.font-medium')[0].textContent = stats.onlineUsers.toLocaleString(); document.querySelectorAll('.font-medium')[1].textContent = stats.countries; document.querySelectorAll('.font-medium')[2].textContent = stats.circuits.toLocaleString(); } catch (error) { console.error("Failed to load stats:", error); } }); </script></script></body></html>index.html+113-43