Download index.html from ZakheTH/testing: direct link, hf CLI and curl.
- Browser
- Download file 22.6 kB
-
https://huggingface.co/spaces/ZakheTH/testing/resolve/main/index.html
- Command line
-
hf download hf://spaces/ZakheTH/testing/index.html
-
curl -L -o index.html https://huggingface.co/spaces/ZakheTH/testing/resolve/main/index.html
22.6 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Siswati PII Detection API</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .gradient-bg { | |
| background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); | |
| } | |
| .text-siswati { | |
| color: #8b5cf6; | |
| } | |
| .border-siswati { | |
| border-color: #8b5cf6; | |
| } | |
| .highlight { | |
| background-color: rgba(167, 139, 250, 0.3); | |
| padding: 0.1rem 0.2rem; | |
| border-radius: 0.25rem; | |
| color: #e9d5ff; | |
| } | |
| .risk-high { background-color: rgba(239, 68, 68, 0.2); color: #fca5a5; } | |
| .risk-medium { background-color: rgba(245, 158, 11, 0.2); color: #fcd34d; } | |
| .risk-low { background-color: rgba(16, 185, 129, 0.2); color: #6ee7b7; } | |
| /* Custom scrollbar */ | |
| ::-webkit-scrollbar { | |
| width: 8px; | |
| } | |
| ::-webkit-scrollbar-track { | |
| background: #1f2937; | |
| } | |
| ::-webkit-scrollbar-thumb { | |
| background: #4b5563; | |
| border-radius: 4px; | |
| } | |
| ::-webkit-scrollbar-thumb:hover { | |
| background: #6b7280; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-900 text-gray-200 min-h-screen"> | |
| <header class="gradient-bg text-white shadow-lg"> | |
| <div class="container mx-auto px-4 py-6"> | |
| <div class="flex justify-between items-center"> | |
| <div class="flex items-center space-x-3"> | |
| <i class="fas fa-user-shield text-3xl"></i> | |
| <h1 class="text-2xl font-bold">Siswati PII Detection API</h1> | |
| </div> | |
| <nav class="hidden md:flex space-x-6"> | |
| <a href="#demo" class="hover:text-gray-200 transition">Demo</a> | |
| <a href="#pii-types" class="hover:text-gray-200 transition">PII Types</a> | |
| <a href="#api-reference" class="hover:text-gray-200 transition">API Reference</a> | |
| </nav> | |
| </div> | |
| <div class="mt-12 text-center pb-16"> | |
| <h2 class="text-4xl md:text-5xl font-bold mb-4">Detect Personal Data in <span class="text-purple-300">Siswati</span></h2> | |
| <p class="text-xl md:text-2xl max-w-3xl mx-auto mb-8">Identify and protect personally identifiable information in Siswati text with our specialized API</p> | |
| <div class="flex justify-center space-x-4"> | |
| <button class="bg-white text-siswati px-6 py-3 rounded-lg font-bold hover:bg-gray-100 transition">Get API Key</button> | |
| <button onclick="document.getElementById('demo').scrollIntoView()" class="border-2 border-white text-white px-6 py-3 rounded-lg font-bold hover:bg-white hover:text-siswati transition">Try Demo</button> | |
| </div> | |
| </div> | |
| </div> | |
| </header> | |
| <section id="demo" class="py-16 bg-gray-800"> | |
| <div class="container mx-auto px-4"> | |
| <h2 class="text-3xl font-bold text-center mb-12 text-purple-300">PII Detection Demo</h2> | |
| <div class="bg-gray-700 rounded-xl shadow-lg overflow-hidden max-w-4xl mx-auto border border-gray-600"> | |
| <div class="p-6 border-b border-gray-600"> | |
| <div class="flex space-x-2"> | |
| <div class="w-3 h-3 rounded-full bg-red-500"></div> | |
| <div class="w-3 h-3 rounded-full bg-yellow-500"></div> | |
| <div class="w-3 h-3 rounded-full bg-green-500"></div> | |
| </div> | |
| </div> | |
| <div class="p-6"> | |
| <div class="flex items-center mb-4"> | |
| <span class="bg-purple-600 text-white px-3 py-1 rounded-full text-sm font-bold mr-3">POST</span> | |
| <span class="font-mono text-gray-300">https://api.siswati-dlp.com/v1/detect-pii</span> | |
| </div> | |
| <div class="grid md:grid-cols-2 gap-6"> | |
| <div> | |
| <h3 class="font-bold mb-2 text-gray-300">Request</h3> | |
| <div class="bg-gray-900 rounded-lg p-4 border border-gray-600"> | |
| <pre class="text-purple-300 text-sm overflow-x-auto"> | |
| <code>{ | |
| "text": "Ligama lami nguSipho Dlamini. | |
| Linombolo yami yekhasisi i-1234-5678-9012-3456. | |
| Sihlala eMbabane, linombolo yami yemucu i-123456789.", | |
| "language": "ss", | |
| "options": { | |
| "returnRiskScores": true, | |
| "highlightMatches": true | |
| } | |
| }</code> | |
| </pre> | |
| </div> | |
| <div class="mt-4"> | |
| <label class="block text-sm font-medium text-gray-300 mb-2">Enter Siswati text with PII:</label> | |
| <textarea id="inputText" class="w-full bg-gray-800 border border-gray-600 rounded-lg p-3 h-32 text-gray-200 placeholder-gray-500 focus:border-purple-500 focus:ring-purple-500" placeholder="Faka umbhalo wakho wesSiSwati lapha...">Ligama lami nguSipho Dlamini. Linombolo yami yekhasisi i-1234-5678-9012-3456. Sihlala eMbabane, linombolo yami yemucu i-123456789.</textarea> | |
| <button onclick="detectPII()" class="mt-3 bg-purple-600 text-white px-4 py-2 rounded-lg hover:bg-purple-700 transition font-medium">Detect PII</button> | |
| </div> | |
| </div> | |
| <div> | |
| <h3 class="font-bold mb-2 text-gray-300">Response</h3> | |
| <div class="bg-gray-900 rounded-lg p-4 h-96 overflow-y-auto border border-gray-600"> | |
| <pre id="responseOutput" class="text-sm text-gray-300">{ | |
| "piiFindings": [ | |
| { | |
| "type": "PERSON_NAME", | |
| "score": 0.98, | |
| "risk": "HIGH", | |
| "match": "Sipho Dlamini", | |
| "context": "Ligama lami nguSipho Dlamini" | |
| }, | |
| { | |
| "type": "CREDIT_CARD_NUMBER", | |
| "score": 0.95, | |
| "risk": "HIGH", | |
| "match": "1234-5678-9012-3456", | |
| "context": "Linombolo yami yekhasisi i-1234-5678-9012-3456" | |
| }, | |
| { | |
| "type": "NATIONAL_ID", | |
| "score": 0.92, | |
| "risk": "HIGH", | |
| "match": "123456789", | |
| "context": "linombolo yami yemucu i-123456789" | |
| }, | |
| { | |
| "type": "LOCATION", | |
| "score": 0.85, | |
| "risk": "MEDIUM", | |
| "match": "Mbabane", | |
| "context": "Sihlala eMbabane" | |
| } | |
| ], | |
| "processedText": "Ligama lami ngu<span class='highlight'>Sipho Dlamini</span>. | |
| Linombolo yami yekhasisi i-<span class='highlight'>1234-5678-9012-3456</span>. | |
| Sihlala e<span class='highlight'>Mbabane</span>, linombolo yami yemucu i-<span class='highlight'>123456789</span>.", | |
| "stats": { | |
| "totalPiiFound": 4, | |
| "highRiskCount": 3, | |
| "mediumRiskCount": 1, | |
| "lowRiskCount": 0 | |
| } | |
| }</pre> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <section id="pii-types" class="py-16 bg-gray-800"> | |
| <div class="container mx-auto px-4"> | |
| <h2 class="text-3xl font-bold text-center mb-12 text-purple-300">Supported PII Types</h2> | |
| <div class="max-w-4xl mx-auto"> | |
| <div class="bg-gray-700 rounded-lg shadow overflow-hidden border border-gray-600"> | |
| <table class="min-w-full divide-y divide-gray-600"> | |
| <thead class="bg-gray-700"> | |
| <tr> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">PII Type</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Risk Level</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Detection Method</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Examples</th> | |
| </tr> | |
| </thead> | |
| <tbody class="divide-y divide-gray-600"> | |
| <tr class="hover:bg-gray-700/50"> | |
| <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-200">Full Name</td> | |
| <td class="px-6 py-4"><span class="risk-high px-2 py-1 rounded-full text-xs">HIGH</span></td> | |
| <td class="px-6 py-4 text-gray-400">Pattern matching for common Siswati name structures</td> | |
| <td class="px-6 py-4 text-gray-400">Sipho Dlamini, Nomvula Nkosi</td> | |
| </tr> | |
| <tr class="hover:bg-gray-700/50"> | |
| <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-200">National ID</td> | |
| <td class="px-6 py-4"><span class="risk-high px-2 py-1 rounded-full text-xs">HIGH</span></td> | |
| <td class="px-6 py-4 text-gray-400">Eswatini ID number patterns and checksums</td> | |
| <td class="px-6 py-4 text-gray-400">123456789, 987-654-321</td> | |
| </tr> | |
| <tr class="hover:bg-gray-700/50"> | |
| <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-200">Bank Account</td> | |
| <td class="px-6 py-4"><span class="risk-high px-2 py-1 rounded-full text-xs">HIGH</span></td> | |
| <td class="px-6 py-4 text-gray-400">Bank-specific account number patterns</td> | |
| <td class="px-6 py-4 text-gray-400">1234567890, 9876543210</td> | |
| </tr> | |
| <tr class="hover:bg-gray-700/50"> | |
| <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-200">Phone Number</td> | |
| <td class="px-6 py-4"><span class="risk-medium px-2 py-1 rounded-full text-xs">MEDIUM</span></td> | |
| <td class="px-6 py-4 text-gray-400">Eswatini phone number formats</td> | |
| <td class="px-6 py-4 text-gray-400">+268 76 123 4567, 761234567</td> | |
| </tr> | |
| <tr class="hover:bg-gray-700/50"> | |
| <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-200">Email Address</td> | |
| <td class="px-6 py-4"><span class="risk-medium px-2 py-1 rounded-full text-xs">MEDIUM</span></td> | |
| <td class="px-6 py-4 text-gray-400">Standard email patterns with common domains</td> | |
| <td class="px-6 py-4 text-gray-400">sipho@example.co.sz</td> | |
| </tr> | |
| <tr class="hover:bg-gray-700/50"> | |
| <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-200">Location</td> | |
| <td class="px-6 py-4"><span class="risk-medium px-2 py-1 rounded-full text-xs">MEDIUM</span></td> | |
| <td class="px-6 py-4 text-gray-400">Eswatini place names database</td> | |
| <td class="px-6 py-4 text-gray-400">Mbabane, Manzini, Lobamba</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <section id="api-reference" class="py-16 bg-gray-800"> | |
| <div class="container mx-auto px-4"> | |
| <h2 class="text-3xl font-bold text-center mb-12 text-purple-300">API Reference</h2> | |
| <div class="max-w-4xl mx-auto space-y-8"> | |
| <div class="bg-gray-700 p-6 rounded-lg border border-gray-600"> | |
| <h3 class="text-xl font-bold mb-4 text-purple-300">Endpoint: Detect PII</h3> | |
| <div class="mb-4"> | |
| <span class="bg-purple-600 text-white px-3 py-1 rounded-full text-sm font-bold mr-3">POST</span> | |
| <span class="font-mono text-gray-300">/v1/detect-pii</span> | |
| </div> | |
| <h4 class="font-bold mb-2 text-gray-300">Request Parameters</h4> | |
| <div class="bg-gray-900 rounded-lg p-4 mb-4 border border-gray-600"> | |
| <pre class="text-purple-300 text-sm overflow-x-auto"> | |
| <code>{ | |
| "text": "string", // Required: Text to analyze | |
| "language": "ss", // Required: Language code for Siswati | |
| "options": { | |
| "returnRiskScores": boolean, // Whether to include risk scores | |
| "highlightMatches": boolean, // Whether to highlight matches | |
| "strictMode": boolean // Use stricter matching rules | |
| } | |
| }</code> | |
| </pre> | |
| </div> | |
| <h4 class="font-bold mb-2 text-gray-300">Response Fields</h4> | |
| <div class="bg-gray-900 rounded-lg p-4 border border-gray-600"> | |
| <pre class="text-purple-300 text-sm overflow-x-auto"> | |
| <code>{ | |
| "piiFindings": [ // Array of detected PII | |
| { | |
| "type": "string", // PII type (e.g., "PERSON_NAME") | |
| "score": number, // Confidence score (0-1) | |
| "risk": "string", // Risk level (HIGH/MEDIUM/LOW) | |
| "match": "string", // The matched text | |
| "context": "string" // Surrounding text for context | |
| } | |
| ], | |
| "processedText": "string", // Text with PII highlighted | |
| "stats": { // Summary statistics | |
| "totalPiiFound": number, | |
| "highRiskCount": number, | |
| "mediumRiskCount": number, | |
| "lowRiskCount": number | |
| } | |
| }</code> | |
| </pre> | |
| </div> | |
| </div> | |
| <div class="bg-gray-700 p-6 rounded-lg border border-gray-600"> | |
| <h3 class="text-xl font-bold mb-4 text-purple-300">Error Responses</h3> | |
| <div class="bg-gray-900 rounded-lg p-4 border border-gray-600"> | |
| <pre class="text-purple-300 text-sm overflow-x-auto"> | |
| <code>{ | |
| "error": { | |
| "code": "string", // Error code (e.g., "INVALID_TEXT") | |
| "message": "string", // Human-readable message | |
| "details": "string" // Additional details if available | |
| } | |
| }</code> | |
| </pre> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <footer class="bg-gray-800 border-t border-gray-700 text-gray-400 py-12"> | |
| <div class="container mx-auto px-4 text-center"> | |
| <div class="flex justify-center mb-6"> | |
| <div class="bg-gray-700 p-4 rounded-full"> | |
| <i class="fas fa-user-shield text-3xl text-purple-400"></i> | |
| </div> | |
| </div> | |
| <h3 class="text-xl font-bold mb-4 text-purple-300">Siswati PII Detection API</h3> | |
| <p class="mb-6 max-w-2xl mx-auto">Protecting personal data in the Siswati language with advanced detection algorithms</p> | |
| <div class="flex justify-center space-x-6 mb-6"> | |
| <a href="#" class="text-xl hover:text-purple-300 transition"><i class="fab fa-twitter"></i></a> | |
| <a href="#" class="text-xl hover:text-purple-300 transition"><i class="fab fa-github"></i></a> | |
| <a href="#" class="text-xl hover:text-purple-300 transition"><i class="fas fa-envelope"></i></a> | |
| <a href="#" class="text-xl hover:text-purple-300 transition"><i class="fas fa-book"></i></a> | |
| </div> | |
| <div class="text-sm"> | |
| <p>© 2025 Siswati PII Detection API. All rights reserved.</p> | |
| <div class="mt-2 space-x-4"> | |
| <a href="#" class="hover:text-purple-300">Privacy Policy</a> | |
| <a href="#" class="hover:text-purple-300">Terms of Service</a> | |
| <a href="#" class="hover:text-purple-300">Documentation</a> | |
| </div> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| function detectPII() { | |
| const inputText = document.getElementById('inputText').value; | |
| // Show loading state | |
| const responseOutput = document.getElementById('responseOutput'); | |
| responseOutput.innerHTML = '<div class="text-center text-gray-500">Detecting PII in Siswati text...</div>'; | |
| // Simulate API call with setTimeout | |
| setTimeout(() => { | |
| // Mock response based on input | |
| const mockResponse = { | |
| piiFindings: [], | |
| processedText: inputText, | |
| stats: { | |
| totalPiiFound: 0, | |
| highRiskCount: 0, | |
| mediumRiskCount: 0, | |
| lowRiskCount: 0 | |
| } | |
| }; | |
| // Check for name pattern (capitalized words) | |
| const nameMatch = inputText.match(/(?:[A-Z][a-z]+ ){1,2}[A-Z][a-z]+/); | |
| if (nameMatch) { | |
| mockResponse.piiFindings.push({ | |
| type: "PERSON_NAME", | |
| score: 0.95 + Math.random() * 0.04, | |
| risk: "HIGH", | |
| match: nameMatch[0], | |
| context: inputText.substring(Math.max(0, nameMatch.index - 20), | |
| Math.min(inputText.length, nameMatch.index + nameMatch[0].length + 20)) | |
| }); | |
| } | |
| // Check for credit card pattern | |
| const ccMatch = inputText.match(/\d{4}-\d{4}-\d{4}-\d{4}/); | |
| if (ccMatch) { | |
| mockResponse.piiFindings.push({ | |
| type: "CREDIT_CARD_NUMBER", | |
| score: 0.98, | |
| risk: "HIGH", | |
| match: ccMatch[0], | |
| context: inputText.substring(Math.max(0, ccMatch.index - 20), | |
| Math.min(inputText.length, ccMatch.index + ccMatch[0].length + 20)) | |
| }); | |
| } | |
| // Check for national ID pattern | |
| const idMatch = inputText.match(/\d{8,10}/); | |
| if (idMatch) { | |
| mockResponse.piiFindings.push({ | |
| type: "NATIONAL_ID", | |
| score: 0.90 + Math.random() * 0.05, | |
| risk: "HIGH", | |
| match: idMatch[0], | |
| context: inputText.substring(Math.max(0, idMatch.index - 20), | |
| Math.min(inputText.length, idMatch.index + idMatch[0].length + 20)) | |
| }); | |
| } | |
| // Check for location pattern | |
| const locMatch = inputText.match(/e([A-Z][a-z]+)/); | |
| if (locMatch) { | |
| mockResponse.piiFindings.push({ | |
| type: "LOCATION", | |
| score: 0.80 + Math.random() * 0.10, | |
| risk: "MEDIUM", | |
| match: locMatch[1], | |
| context: inputText.substring(Math.max(0, locMatch.index - 20), | |
| Math.min(inputText.length, locMatch.index + locMatch[0].length + 20)) | |
| }); | |
| } | |
| // Update stats | |
| mockResponse.stats.totalPiiFound = mockResponse.piiFindings.length; | |
| mockResponse.stats.highRiskCount = mockResponse.piiFindings.filter(f => f.risk === "HIGH").length; | |
| mockResponse.stats.mediumRiskCount = mockResponse.piiFindings.filter(f => f.risk === "MEDIUM").length; | |
| // Process text with highlights | |
| mockResponse.processedText = inputText; | |
| mockResponse.piiFindings.forEach(finding => { | |
| mockResponse.processedText = mockResponse.processedText.replace( | |
| new RegExp(escapeRegExp(finding.match), 'g'), | |
| `<span class="highlight">${finding.match}</span>` | |
| ); | |
| }); | |
| // Display the formatted response | |
| responseOutput.innerHTML = JSON.stringify(mockResponse, null, 2) | |
| .replace(/"<span class="highlight">/g, '<span class="highlight">') | |
| .replace(/<\/span>"/g, '</span>'); | |
| }, 1000); | |
| } | |
| function escapeRegExp(string) { | |
| return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
| } | |
| </script> | |
| <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=ZakheTH/sz-data-loss-prevention-sz" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p><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=ZakheTH/testing" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |