Spaces:
Running
Running
Download index.html from sudeep1610/ResumeBot: direct link, hf CLI and curl.
- Browser
- Download file 5.87 kB
-
https://huggingface.co/spaces/sudeep1610/ResumeBot/resolve/main/index.html
- Command line
-
hf download hf://spaces/sudeep1610/ResumeBot/index.html
-
curl -L -o index.html https://huggingface.co/spaces/sudeep1610/ResumeBot/resolve/main/index.html
5.87 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>ResumeBot — Ask about Sudeep</title> | |
| <style> | |
| :root { --bg:#0f172a; --card:#111c33; --line:#23314f; --text:#e5e9f2; --muted:#94a3b8; --accent:#6366f1; --user:#4f46e5; --bot:#1e293b; } | |
| * { box-sizing: border-box; } | |
| body { margin:0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background:var(--bg); color:var(--text); | |
| min-height:100vh; display:flex; justify-content:center; padding:24px 16px; } | |
| .app { width:100%; max-width:760px; display:flex; flex-direction:column; gap:16px; } | |
| header h1 { margin:0; font-size:26px; } | |
| header p { margin:6px 0 0; color:var(--muted); font-size:14px; line-height:1.5; } | |
| .status { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:14px 16px; font-size:14px; color:var(--muted); } | |
| .bar { height:6px; background:var(--line); border-radius:4px; margin-top:10px; overflow:hidden; } | |
| .bar > div { height:100%; width:0; background:var(--accent); transition:width .2s; } | |
| .chat { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:16px; min-height:340px; | |
| display:flex; flex-direction:column; gap:12px; overflow-y:auto; max-height:60vh; } | |
| .msg { max-width:85%; padding:10px 14px; border-radius:14px; line-height:1.5; font-size:15px; white-space:pre-wrap; } | |
| .user { align-self:flex-end; background:var(--user); color:#fff; border-bottom-right-radius:4px; } | |
| .bot { align-self:flex-start; background:var(--bot); border:1px solid var(--line); border-bottom-left-radius:4px; } | |
| .typing { color:var(--muted); font-style:italic; } | |
| .chips { display:flex; flex-wrap:wrap; gap:8px; } | |
| .chip { background:transparent; color:var(--text); border:1px solid var(--line); border-radius:999px; padding:6px 12px; font-size:13px; cursor:pointer; } | |
| .chip:hover { border-color:var(--accent); } | |
| form { display:flex; gap:8px; } | |
| input { flex:1; min-width:0; background:var(--card); color:var(--text); border:1px solid var(--line); border-radius:10px; padding:12px 14px; font-size:15px; } | |
| input:focus { outline:2px solid var(--accent); border-color:transparent; } | |
| button.send { background:var(--accent); color:#fff; border:0; border-radius:10px; padding:0 20px; font-size:15px; cursor:pointer; } | |
| button:disabled, input:disabled { opacity:.5; cursor:not-allowed; } | |
| footer { color:var(--muted); font-size:12px; text-align:center; } | |
| footer a { color:var(--muted); } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="app"> | |
| <header> | |
| <h1>🤖 ResumeBot</h1> | |
| <p>Ask anything about <b>Sudeep's</b> resume: education, skills, projects, certifications and achievements. | |
| Powered by my own <b>FLAN-T5 model fine-tuned on my resume</b>. It runs right here in your browser.</p> | |
| </header> | |
| <div class="status" id="status">Loading the model (first visit downloads it once, about 1 minute)…<div class="bar"><div id="bar"></div></div></div> | |
| <div class="chat" id="chat"> | |
| <div class="msg bot">Hi! I'm ResumeBot. Ask me a question about Sudeep 👋</div> | |
| </div> | |
| <div class="chips" id="chips"> | |
| <button class="chip">What are Sudeep's technical skills?</button> | |
| <button class="chip">What is his educational qualification?</button> | |
| <button class="chip">What projects has Sudeep done?</button> | |
| <button class="chip">What certifications does he have?</button> | |
| <button class="chip">Has he won any awards?</button> | |
| </div> | |
| <form id="form"> | |
| <input id="input" placeholder="Type your question…" autocomplete="off" disabled> | |
| <button class="send" id="send" disabled>Ask</button> | |
| </form> | |
| <footer>Model: <a id="modelLink" target="_blank"></a> · fine-tuned from google/flan-t5-base</footer> | |
| </div> | |
| <script type="module"> | |
| import { pipeline, env } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0"; | |
| const MODEL = "sudeep1610/resume-llm"; // your model on Hugging Face | |
| const $ = id => document.getElementById(id); | |
| $("modelLink").textContent = MODEL; | |
| $("modelLink").href = "https://huggingface.co/" + MODEL; | |
| const files = {}; | |
| function onProgress(p) { | |
| if (p.status === "progress" && p.total) { | |
| files[p.file] = [p.loaded, p.total]; | |
| const [l, t] = Object.values(files).reduce((a, [x, y]) => [a[0] + x, a[1] + y], [0, 0]); | |
| $("bar").style.width = (100 * l / t).toFixed(0) + "%"; | |
| } | |
| } | |
| function add(text, who) { | |
| const d = document.createElement("div"); | |
| d.className = "msg " + who; | |
| d.textContent = text; | |
| $("chat").appendChild(d); | |
| $("chat").scrollTop = $("chat").scrollHeight; | |
| return d; | |
| } | |
| let bot; | |
| try { | |
| bot = await pipeline("text2text-generation", MODEL, { dtype: "q8", progress_callback: onProgress }); | |
| $("status").style.display = "none"; | |
| $("input").disabled = $("send").disabled = false; | |
| $("input").focus(); | |
| } catch (e) { | |
| $("status").textContent = "Could not load the model: " + e.message; | |
| } | |
| async function ask(question) { | |
| question = question.trim(); | |
| if (!question || !bot) return; | |
| add(question, "user"); | |
| $("input").value = ""; | |
| $("input").disabled = $("send").disabled = true; | |
| const typing = add("Thinking…", "bot typing"); | |
| try { | |
| const out = await bot(question, { max_new_tokens: 128, num_beams: 1 }); | |
| typing.className = "msg bot"; | |
| typing.textContent = out[0].generated_text.trim() || "Sorry, I don't know that."; | |
| } catch (e) { | |
| typing.textContent = "Error: " + e.message; | |
| } | |
| $("input").disabled = $("send").disabled = false; | |
| $("input").focus(); | |
| } | |
| $("form").addEventListener("submit", e => { e.preventDefault(); ask($("input").value); }); | |
| document.querySelectorAll(".chip").forEach(c => c.addEventListener("click", () => ask(c.textContent))); | |
| </script> | |
| </body> | |
| </html> | |