Spaces:
Sleeping

docker / public /index.html
Enternal1's picture
Upload 19 files
dd55845 verified
Raw History Blame Contribute Delete
2.24 kB
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>SHL Recommendations</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body { font-family: system-ui, sans-serif; margin: 2rem; }
textarea { width: 100%; }
table { border-collapse: collapse; width: 100%; margin-top: 1rem; }
th, td { border: 1px solid #ddd; padding: 8px; }
th { background: #f3f3f3; }
</style>
</head>
<body>
<h1>SHL Recommendations</h1>
<p>Use this page deployed on Vercel to query the backend and view results.</p>
<div>
<label>Input Type</label>
<select id="input_type">
<option value="text">text</option>
<option value="jd_text">jd_text</option>
<option value="jd_url">jd_url</option>
</select>
</div>
<div>
<textarea id="query" rows="8" placeholder="Enter query or JD text or URL"></textarea>
</div>
<button id="btn">Recommend</button>
<table>
<thead><tr><th>Name</th><th>URL</th><th>Type</th></tr></thead>
<tbody id="rows"></tbody>
</table>
<script>
document.getElementById('btn').addEventListener('click', async () => {
const input_type = document.getElementById('input_type').value;
const query = document.getElementById('query').value;
const r = await fetch('/api/recommend', {
method:'POST',
headers:{'Content-Type':'application/json'},
body: JSON.stringify({ input_type, query, top_k: 10 })
});
const j = await r.json();
const tb = document.getElementById('rows');
tb.innerHTML = '';
for(const it of j.items || []){
const tr = document.createElement('tr');
const td1 = document.createElement('td'); td1.textContent = it.name;
const td2 = document.createElement('td'); const a = document.createElement('a'); a.href=it.url; a.textContent=it.url; a.target='_blank'; td2.appendChild(a);
const td3 = document.createElement('td'); td3.textContent = it.type || '';
tr.appendChild(td1); tr.appendChild(td2); tr.appendChild(td3);
tb.appendChild(tr);
}
});
</script>
</body>
</html>