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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Resume Optimizer</title>
|
7 |
+
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
8 |
+
<style>
|
9 |
+
:root {
|
10 |
+
--primary-color: #003366;
|
11 |
+
--secondary-color: #f0f2f5;
|
12 |
+
--accent-color: #ff6b6b;
|
13 |
+
}
|
14 |
+
body {
|
15 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
16 |
+
line-height: 1.6;
|
17 |
+
margin: 0;
|
18 |
+
padding: 20px;
|
19 |
+
background-color: var(--secondary-color);
|
20 |
+
color: #333;
|
21 |
+
}
|
22 |
+
.container {
|
23 |
+
max-width: 1200px;
|
24 |
+
margin: 0 auto;
|
25 |
+
}
|
26 |
+
h1, h2 {
|
27 |
+
color: var(--primary-color);
|
28 |
+
}
|
29 |
+
h1 {
|
30 |
+
text-align: center;
|
31 |
+
margin-bottom: 30px;
|
32 |
+
}
|
33 |
+
form {
|
34 |
+
background: #ffffff;
|
35 |
+
padding: 20px;
|
36 |
+
border-radius: 8px;
|
37 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
38 |
+
margin-bottom: 30px;
|
39 |
+
display: flex;
|
40 |
+
flex-wrap: wrap;
|
41 |
+
gap: 20px;
|
42 |
+
align-items: flex-start;
|
43 |
+
}
|
44 |
+
.form-group {
|
45 |
+
flex: 1 1 calc(50% - 10px);
|
46 |
+
min-width: 250px;
|
47 |
+
}
|
48 |
+
label {
|
49 |
+
display: block;
|
50 |
+
margin-bottom: 8px;
|
51 |
+
color: var(--primary-color);
|
52 |
+
font-weight: bold;
|
53 |
+
}
|
54 |
+
input[type="text"], input[type="file"], textarea {
|
55 |
+
width: 100%;
|
56 |
+
padding: 10px;
|
57 |
+
margin-bottom: 10px;
|
58 |
+
border: 1px solid #ccc;
|
59 |
+
border-radius: 4px;
|
60 |
+
font-size: 14px;
|
61 |
+
transition: border-color 0.3s ease;
|
62 |
+
box-sizing: border-box;
|
63 |
+
}
|
64 |
+
input[type="text"]:focus, textarea:focus {
|
65 |
+
border-color: var(--accent-color);
|
66 |
+
outline: none;
|
67 |
+
}
|
68 |
+
textarea {
|
69 |
+
height: 150px;
|
70 |
+
resize: vertical;
|
71 |
+
}
|
72 |
+
.button-container {
|
73 |
+
flex-basis: 100%;
|
74 |
+
display: flex;
|
75 |
+
justify-content: center;
|
76 |
+
margin-top: 20px;
|
77 |
+
}
|
78 |
+
button {
|
79 |
+
background: var(--primary-color);
|
80 |
+
color: #fff;
|
81 |
+
padding: 10px 20px;
|
82 |
+
border: none;
|
83 |
+
border-radius: 4px;
|
84 |
+
cursor: pointer;
|
85 |
+
font-size: 16px;
|
86 |
+
transition: background-color 0.3s ease;
|
87 |
+
width: auto;
|
88 |
+
min-width: 200px;
|
89 |
+
}
|
90 |
+
button:hover {
|
91 |
+
background: var(--accent-color);
|
92 |
+
}
|
93 |
+
.report-section {
|
94 |
+
background-color: #ffffff;
|
95 |
+
padding: 40px;
|
96 |
+
border-radius: 8px;
|
97 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
98 |
+
margin-top: 30px;
|
99 |
+
display: none;
|
100 |
+
}
|
101 |
+
.report-section h2 {
|
102 |
+
border-bottom: 2px solid var(--accent-color);
|
103 |
+
padding-bottom: 10px;
|
104 |
+
margin-top: 0;
|
105 |
+
}
|
106 |
+
.markdown-body {
|
107 |
+
font-size: 14px;
|
108 |
+
line-height: 1.6;
|
109 |
+
}
|
110 |
+
pre {
|
111 |
+
background-color: #f6f8fa;
|
112 |
+
border-radius: 4px;
|
113 |
+
padding: 15px;
|
114 |
+
overflow-x: auto;
|
115 |
+
font-size: 12px;
|
116 |
+
}
|
117 |
+
#loading {
|
118 |
+
text-align: center;
|
119 |
+
display: none;
|
120 |
+
padding: 20px;
|
121 |
+
}
|
122 |
+
.spinner {
|
123 |
+
display: inline-block;
|
124 |
+
width: 50px;
|
125 |
+
height: 50px;
|
126 |
+
border: 3px solid rgba(0,51,102,.3);
|
127 |
+
border-radius: 50%;
|
128 |
+
border-top-color: var(--primary-color);
|
129 |
+
animation: spin 1s ease-in-out infinite;
|
130 |
+
-webkit-animation: spin 1s ease-in-out infinite;
|
131 |
+
}
|
132 |
+
@keyframes spin {
|
133 |
+
to { -webkit-transform: rotate(360deg); }
|
134 |
+
}
|
135 |
+
@-webkit-keyframes spin {
|
136 |
+
to { -webkit-transform: rotate(360deg); }
|
137 |
+
}
|
138 |
+
.loading-text {
|
139 |
+
margin-top: 10px;
|
140 |
+
font-weight: bold;
|
141 |
+
color: var(--primary-color);
|
142 |
+
}
|
143 |
+
@media (max-width: 768px) {
|
144 |
+
.form-group {
|
145 |
+
flex: 1 1 100%;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
</style>
|
149 |
+
</head>
|
150 |
+
<body>
|
151 |
+
<div class="container">
|
152 |
+
<h1>Resume Optimizer</h1>
|
153 |
+
<form id="optimizeForm">
|
154 |
+
<div class="form-group">
|
155 |
+
<label for="resumeText">Resume:</label>
|
156 |
+
<textarea id="resumeText" placeholder="Paste your resume here"></textarea>
|
157 |
+
<input type="file" id="resumeFile" accept=".txt,.pdf,.doc,.docx">
|
158 |
+
</div>
|
159 |
+
<div class="form-group">
|
160 |
+
<label for="jobDescriptionText">Job Description:</label>
|
161 |
+
<textarea id="jobDescriptionText" placeholder="Paste the job description here"></textarea>
|
162 |
+
<input type="text" id="jobDescriptionUrl" placeholder="Or enter job description URL">
|
163 |
+
</div>
|
164 |
+
<div class="button-container">
|
165 |
+
<button type="submit">Optimize Resume</button>
|
166 |
+
</div>
|
167 |
+
</form>
|
168 |
+
<div id="loading">
|
169 |
+
<div class="spinner"></div>
|
170 |
+
<div class="loading-text">Optimizing your resume...</div>
|
171 |
+
</div>
|
172 |
+
<div id="optimizedResumeContainer" class="report-section"></div>
|
173 |
+
<div id="changesMadeContainer" class="report-section"></div>
|
174 |
+
</div>
|
175 |
+
|
176 |
+
<script>
|
177 |
+
const AUTH_TOKEN = "44d5c2ac18ced6fc25c1e57dcd06fc0b31fb4ad97bf56e67540671a647465df4";
|
178 |
+
|
179 |
+
document.getElementById('optimizeForm').addEventListener('submit', async (e) => {
|
180 |
+
e.preventDefault();
|
181 |
+
const optimizedResumeContainer = document.getElementById('optimizedResumeContainer');
|
182 |
+
const changesMadeContainer = document.getElementById('changesMadeContainer');
|
183 |
+
const loadingDiv = document.getElementById('loading');
|
184 |
+
|
185 |
+
// Hide result containers and show loading animation
|
186 |
+
optimizedResumeContainer.style.display = 'none';
|
187 |
+
changesMadeContainer.style.display = 'none';
|
188 |
+
loadingDiv.style.display = 'block';
|
189 |
+
|
190 |
+
const formData = new FormData();
|
191 |
+
|
192 |
+
// Handle resume input
|
193 |
+
const resumeText = document.getElementById('resumeText').value;
|
194 |
+
const resumeFile = document.getElementById('resumeFile').files[0];
|
195 |
+
if (resumeText) {
|
196 |
+
formData.append('resumeText', resumeText);
|
197 |
+
} else if (resumeFile) {
|
198 |
+
formData.append('resume', resumeFile);
|
199 |
+
} else {
|
200 |
+
loadingDiv.innerHTML = '<div class="loading-text" style="color: red;">Please provide a resume (text or file).</div>';
|
201 |
+
return;
|
202 |
+
}
|
203 |
+
|
204 |
+
// Handle job description input
|
205 |
+
const jobDescriptionText = document.getElementById('jobDescriptionText').value;
|
206 |
+
const jobDescriptionUrl = document.getElementById('jobDescriptionUrl').value;
|
207 |
+
if (jobDescriptionText) {
|
208 |
+
formData.append('jobDescription', jobDescriptionText);
|
209 |
+
} else if (jobDescriptionUrl) {
|
210 |
+
formData.append('jobDescriptionUrl', jobDescriptionUrl);
|
211 |
+
} else {
|
212 |
+
loadingDiv.innerHTML = '<div class="loading-text" style="color: red;">Please provide a job description (text or URL).</div>';
|
213 |
+
return;
|
214 |
+
}
|
215 |
+
|
216 |
+
try {
|
217 |
+
const response = await fetch('https://pvanand-specialized-agents.hf.space/api/v1/optimize-resume', {
|
218 |
+
method: 'POST',
|
219 |
+
headers: {
|
220 |
+
'Authorization': `Bearer ${AUTH_TOKEN}`
|
221 |
+
},
|
222 |
+
body: formData
|
223 |
+
});
|
224 |
+
|
225 |
+
if (!response.ok) {
|
226 |
+
throw new Error(`HTTP error! status: ${response.status}`);
|
227 |
+
}
|
228 |
+
|
229 |
+
const data = await response.json();
|
230 |
+
|
231 |
+
// Parse optimized resume
|
232 |
+
const optimizedResumeMatch = data.optimizedResume.match(/<optimized_resume>([\s\S]*?)<\/optimized_resume>/);
|
233 |
+
const optimizedResume = optimizedResumeMatch ? optimizedResumeMatch[1] : 'Optimized resume not found.';
|
234 |
+
|
235 |
+
// Parse changes made
|
236 |
+
const changesMadeMatch = data.optimizedResume.match(/<changes_made>([\s\S]*?)<\/changes_made>/);
|
237 |
+
const changesMade = changesMadeMatch ? changesMadeMatch[1] : 'Changes not found.';
|
238 |
+
|
239 |
+
// Render the optimized resume using Markdown
|
240 |
+
const optimizedResumeHtml = marked.parse(optimizedResume);
|
241 |
+
|
242 |
+
optimizedResumeContainer.innerHTML = `
|
243 |
+
<h2>Optimized Resume</h2>
|
244 |
+
<div class="markdown-body">${optimizedResumeHtml}</div>
|
245 |
+
`;
|
246 |
+
|
247 |
+
changesMadeContainer.innerHTML = `
|
248 |
+
<h2>Changes Made</h2>
|
249 |
+
<div class="markdown-body">${marked.parse(changesMade)}</div>
|
250 |
+
`;
|
251 |
+
|
252 |
+
// Hide loading animation and show result containers
|
253 |
+
loadingDiv.style.display = 'none';
|
254 |
+
optimizedResumeContainer.style.display = 'block';
|
255 |
+
changesMadeContainer.style.display = 'block';
|
256 |
+
} catch (error) {
|
257 |
+
loadingDiv.innerHTML = `
|
258 |
+
<div class="loading-text" style="color: red;">Error: ${error.message}</div>
|
259 |
+
`;
|
260 |
+
}
|
261 |
+
});
|
262 |
+
</script>
|
263 |
+
</body>
|
264 |
+
</html>
|