Spaces:
Runtime error
Runtime error
Create upload_rank_form.html
Browse files
app/templates/upload_rank_form.html
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "base.html" %}
|
| 2 |
+
|
| 3 |
+
{% block title %}Upload and Rank Resumes{% endblock %}
|
| 4 |
+
|
| 5 |
+
{% block content %}
|
| 6 |
+
<div class="container mt-5">
|
| 7 |
+
<h2 class="mb-4">Test Resume Ranking API</h2>
|
| 8 |
+
|
| 9 |
+
<form id="rankForm" action="{{ url_for('api.rank_resumes') }}" method="POST" enctype="multipart/form-data" onsubmit="submitWithAuth(event)">
|
| 10 |
+
<div class="form-group mb-3">
|
| 11 |
+
<label for="api_key">API Key</label>
|
| 12 |
+
<input type="text" class="form-control" id="api_key" name="api_key" placeholder="Enter your API key" required>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
<div class="form-group mb-3">
|
| 16 |
+
<label for="job_description">Job Description</label>
|
| 17 |
+
<textarea class="form-control" id="job_description" name="job_description" rows="5" required></textarea>
|
| 18 |
+
</div>
|
| 19 |
+
|
| 20 |
+
<div class="form-group mb-3">
|
| 21 |
+
<label for="resumes">Upload Resumes</label>
|
| 22 |
+
<input type="file" class="form-control" id="resumes" name="resumes" accept=".pdf,.doc,.docx" multiple required>
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<button type="submit" class="btn btn-primary">Submit & Rank</button>
|
| 26 |
+
</form>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<script>
|
| 30 |
+
function submitWithAuth(event) {
|
| 31 |
+
event.preventDefault();
|
| 32 |
+
|
| 33 |
+
const form = document.getElementById('rankForm');
|
| 34 |
+
const apiKey = document.getElementById('api_key').value;
|
| 35 |
+
const formData = new FormData(form);
|
| 36 |
+
|
| 37 |
+
fetch(form.action, {
|
| 38 |
+
method: 'POST',
|
| 39 |
+
headers: {
|
| 40 |
+
'Authorization': 'Bearer ' + apiKey
|
| 41 |
+
},
|
| 42 |
+
body: formData
|
| 43 |
+
})
|
| 44 |
+
.then(response => response.text())
|
| 45 |
+
.then(html => {
|
| 46 |
+
document.open();
|
| 47 |
+
document.write(html);
|
| 48 |
+
document.close();
|
| 49 |
+
})
|
| 50 |
+
.catch(err => alert("An error occurred: " + err));
|
| 51 |
+
}
|
| 52 |
+
</script>
|
| 53 |
+
{% endblock %}
|