Update index.html
Browse files12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Black Forest Labs - Load Balanced Streamlit</title><style>html, body {margin: 0;padding: 0;width: 100%;height: 100%;}#loading {position: fixed;top: 0;left: 0;width: 100%;height: 100%;background: rgba(255, 255, 255, 0.8);display: flex;justify-content: center;align-items: center;font-size: 24px;z-index: 1000;}iframe {width: 100%;height: 100vh;border: none;}</style></head><body><div id="loading">Please wait Memilih server optimal...</div><iframe id="streamlit-frame"></iframe><script>const SERVERS = ["https://geminisearch-fu8l82trhp7dadkyncasdm.streamlit.app/?embed=true","https://geminisearch-fu8l82trhp7dadkyncasdm.streamlit.app/?embed=true"];// Fungsi untuk mengecek kecepatan respons serverasync function checkServerSpeed(url) {const start = performance.now();try {const response = await fetch(url, { method: 'HEAD', mode: 'no-cors' });const end = performance.now();return end - start;} catch (error) {console.error(`Error checking ${url}:`, error);return Infinity;}}// Fungsi untuk memilih server berdasarkan kecepatan responsasync function chooseServer() {const speeds = await Promise.all(SERVERS.map(checkServerSpeed));const fastestIndex = speeds.indexOf(Math.min(...speeds));return SERVERS[fastestIndex];}// Fungsi untuk memuat Streamlitasync function loadStreamlit() {const loadingElement = document.getElementById('loading');const iframe = document.getElementById('streamlit-frame');// Cek apakah sudah ada URL yang tersimpan di sessionStoragelet chosenUrl = sessionStorage.getItem('streamlitUrl');if (!chosenUrl) {// Jika belum ada, pilih server dan simpan ke sessionStoragechosenUrl = await chooseServer();sessionStorage.setItem('streamlitUrl', chosenUrl);}// Tampilkan iframe dan sembunyikan loadingiframe.src = chosenUrl;iframe.onload = () => {loadingElement.style.display = 'none';};}// Jalankan loadStreamlit saat halaman dimuatwindow.onload = loadStreamlit;</script></body></html>
index.html+89-19