Spaces:
Sleeping
Sleeping
| <html> | |
| <head> | |
| <title>Intent Classification Tester</title> | |
| <style> | |
| body { font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; } | |
| .form-group { margin-bottom: 15px; } | |
| label { display: block; margin-bottom: 5px; } | |
| textarea { width: 100%; height: 100px; } | |
| select { padding: 5px; } | |
| button { padding: 8px 15px; background: #4CAF50; color: white; border: none; cursor: pointer; } | |
| #result { margin-top: 20px; border: 1px solid #ddd; padding: 15px; white-space: pre-wrap; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Intent Classification Tester</h1> | |
| <div class="form-group"> | |
| <label for="text">Enter text to classify:</label> | |
| <textarea id="text" placeholder="Type your text here..."></textarea> | |
| </div> | |
| <div class="form-group"> | |
| <label for="method">OOD Detection Method:</label> | |
| <select id="method"> | |
| <option value="combined">Combined (Energy + MSP)</option> | |
| <option value="energy">Energy Based</option> | |
| <option value="msp">Maximum Softmax Probability</option> | |
| </select> | |
| </div> | |
| <button onclick="analyzeText()">Analyze Intent</button> | |
| <h2>Result:</h2> | |
| <pre id="result">Results will appear here...</pre> | |
| <script> | |
| async function analyzeText() { | |
| const text = document.getElementById('text').value; | |
| const method = document.getElementById('method').value; | |
| if (!text) { | |
| alert('Please enter some text to analyze'); | |
| return; | |
| } | |
| try { | |
| const response = await fetch('/api/analyze', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| }, | |
| body: JSON.stringify({ text, method }), | |
| }); | |
| const data = await response.json(); | |
| document.getElementById('result').textContent = JSON.stringify(data, null, 2); | |
| } catch (error) { | |
| document.getElementById('result').textContent = 'Error: ' + error.message; | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> | |