Spaces:
Runtime error
Runtime error
File size: 3,831 Bytes
4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 52a9380 4b63522 aef55e8 1bef8f4 aef55e8 1bef8f4 4b63522 52a9380 4b63522 52a9380 4b63522 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | {% extends "base.html" %}
{% block title %}API Documentation{% endblock %}
{% block content %}
<h2 class="mb-4">π Resume Ranker API Documentation</h2>
<h4>π Endpoint</h4>
<pre><code class="copyable">POST https://rankapply-api.hf.space/rank-resumes</code></pre>
<h4>π Authentication</h4>
<p>Include your API key in the <code>Authorization</code> header:</p>
<pre><code class="copyable">Authorization: Bearer your_api_key_here</code></pre>
<p class="text-muted"><small>Never share your API key publicly. Treat it like a password.</small></p>
<h4>Request Parameters</h4>
<ul>
<li><strong>resumes</strong> (file[], required): One or more PDF resumes</li>
<li><strong>job_description</strong> (text, required): The job description to match against</li>
</ul>
<h4>π₯ Example Request (cURL)</h4>
<pre><code class="copyable">curl -X POST https://rankapply-api.hf.space/rank-resumes \
-H "Authorization: Bearer your_api_key_here" \
-F "resumes=@cv1.pdf" \
-F "resumes=@cv2.pdf" \
-F "job_description=We are hiring a backend engineer..."</code></pre>
<h4>π₯ Example Request (Python)</h4>
<pre><code class="copyable">import requests
headers = {
"Authorization": "Bearer your_api_key_here"
}
files = [
('resumes', ('cv1.pdf', open('cv1.pdf', 'rb'), 'application/pdf')),
('resumes', ('cv2.pdf', open('cv2.pdf', 'rb'), 'application/pdf')),
]
data = {
"job_description": "We are hiring a backend engineer..."
}
response = requests.post("https://rankapply-api.hf.space/rank-resumes", headers=headers, files=files, data=data)
print(response.json())</code></pre>
<h4> Sample Response</h4>
<pre><code class="copyable">{
"job_description": "We are hiring a backend engineer...",
"ranked_resumes": [
{
"filename": "cv2.pdf",
"score": 0.8745
},
{
"filename": "cv1.pdf",
"score": 0.6721
}
]
}</code></pre>
<hr class="my-5">
<h4> Try It Now</h4>
<form method="POST" action="{{ url_for('auth.try_api') }}" enctype="multipart/form-data">
<div class="mb-3">
<label for="api_key" class="form-label">API Key</label>
<input type="text" class="form-control" id="api_key" name="api_key"
placeholder="your_api_key_here" required>
</div>
<div class="mb-3">
<label for="resumes" class="form-label">Upload Resumes (PDF)</label>
<input type="file" class="form-control" id="resumes" name="resumes" multiple required>
</div>
<div class="mb-3">
<label for="job_description" class="form-label">Job Description</label>
<textarea class="form-control" id="job_description" name="job_description" rows="4" required></textarea>
</div>
<button type="submit" class="btn btn-success">Submit Test Request</button>
</form>
{% if response %}
<h3>π Resume Ranking Results</h3>
<p><strong>Job Description:</strong> {{ response.job_description }}</p>
<table class="table table-bordered">
<thead>
<tr>
<th>Filename</th>
<th>Score</th>
</tr>
</thead>
<tbody>
{% for r in response.ranked_resumes %}
<tr>
<td>{{ r.filename }}</td>
<td>{{ r.score }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<p class="mt-4"><a href="{{ url_for('auth.dashboard') }}" class="btn btn-secondary">β Back to Dashboard</a></p>
<!-- Copy Button Script -->
<script>
document.querySelectorAll('code.copyable').forEach(block => {
const button = document.createElement('button');
button.innerText = 'Copy';
button.className = 'btn btn-sm btn-outline-primary mb-2 float-end';
button.addEventListener('click', () => {
navigator.clipboard.writeText(block.innerText);
button.innerText = 'Copied!';
setTimeout(() => button.innerText = 'Copy', 1500);
});
block.parentElement.insertBefore(button, block);
});
</script>
{% endblock %}
|