greyexploiter commited on
Commit
1e829fc
·
verified ·
1 Parent(s): 09655d2

first update

Browse files
Files changed (1) hide show
  1. index.html +64 -19
index.html CHANGED
@@ -1,19 +1,64 @@
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
+ <!-- language: HTML, file: index.html, target: Hugging Face Static Space -->
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title>ICMR Lookup Client</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@1.28.0/dist/duckdb-browser.js"></script>
8
+ <style>
9
+ body { background: #0f172a; color: #f8fafc; font-family: monospace; padding: 40px; }
10
+ input, button { background: #1e293b; color: #fff; border: 1px solid #334155; padding: 10px; margin: 5px 0; font-family: monospace; }
11
+ button { cursor: pointer; background: #3b82f6; border: none; }
12
+ pre { background: #1e293b; padding: 15px; border: 5px; overflow-x: auto; }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <h2>ICMR Record Lookup (Client-Side)</h2>
17
+ <div>
18
+ <input type="text" id="query" placeholder="Enter mobile or aadhar..." style="width: 300px;">
19
+ <button onclick="searchData()">Search</button>
20
+ </div>
21
+ <pre id="output">Initializing database engine...</pre>
22
+
23
+ <script>
24
+ let db = null;
25
+
26
+ async function initDB() {
27
+ const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
28
+ const bundle = await duckdb.selectBundle(JSDELIVR_BUNDLES);
29
+ const worker = new Worker(bundle.mainWorker);
30
+ const logger = new duckdb.ConsoleLogger();
31
+ db = new duckdb.AsyncDuckDB(logger, worker);
32
+ await db.instantiate(bundle.mainModule, bundle.workerWorker);
33
+ document.getElementById('output').innerText = "Engine ready. Enter a value to search.";
34
+ }
35
+
36
+ async function searchData() {
37
+ if (!db) return alert("Engine still loading...");
38
+ const val = document.getElementById('query').value.trim();
39
+ if (!val) return alert("Enter a search term");
40
+
41
+ document.getElementById('output').innerText = "Searching remote shards...";
42
+ const conn = await db.connect();
43
+
44
+ try {
45
+ // Query parquet shards directly over HTTP range requests via DuckDB-WASM
46
+ const query = `
47
+ SELECT * FROM 'https://huggingface.co/datasets/greyexploiter/icrm-hitek-fulldb/resolve/main/idx_phone.*.parquet'
48
+ WHERE phone = '${val}'
49
+ LIMIT 5;
50
+ `;
51
+ const result = await conn.query(query);
52
+ const rows = result.toArray().map(row => row.toJSON());
53
+ document.getElementById('output').innerText = JSON.stringify(rows, null, 2);
54
+ } catch (err) {
55
+ document.getElementById('output').innerText = "Error: " + err.message;
56
+ } finally {
57
+ await conn.close();
58
+ }
59
+ }
60
+
61
+ initDB();
62
+ </script>
63
+ </body>
64
+ </html>