webcodelab commited on
Commit
52a9380
Β·
verified Β·
1 Parent(s): a2b0e72

Update app/templates/docs.html

Browse files
Files changed (1) hide show
  1. app/templates/docs.html +24 -24
app/templates/docs.html CHANGED
@@ -5,21 +5,22 @@
5
  <h2 class="mb-4">πŸ“˜ Resume Ranker API Documentation</h2>
6
 
7
  <h4>πŸ”— Endpoint</h4>
8
- <pre><code class="copyable">POST https://yourdomain.com/api/rank-resumes</code></pre>
9
 
10
  <h4>πŸ” Authentication</h4>
11
  <p>Include your API key in the <code>Authorization</code> header:</p>
12
- <pre><code class="copyable">Authorization: Bearer amn=your_api_key_here</code></pre>
 
13
 
14
- <h4>πŸ“€ Request Parameters</h4>
15
  <ul>
16
  <li><strong>resumes</strong> (file[], required): One or more PDF resumes</li>
17
  <li><strong>job_description</strong> (text, required): The job description to match against</li>
18
  </ul>
19
 
20
- <h4>πŸ“₯ Example Request (curl)</h4>
21
- <pre><code class="copyable">curl -X POST https://yourdomain.com/api/rank-resumes \
22
- -H "Authorization: Bearer amn=your_api_key_here" \
23
  -F "resumes=@cv1.pdf" \
24
  -F "resumes=@cv2.pdf" \
25
  -F "job_description=We are hiring a backend engineer..."</code></pre>
@@ -28,7 +29,7 @@
28
  <pre><code class="copyable">import requests
29
 
30
  headers = {
31
- "Authorization": "Bearer amn=your_api_key_here"
32
  }
33
  files = [
34
  ('resumes', ('cv1.pdf', open('cv1.pdf', 'rb'), 'application/pdf')),
@@ -38,12 +39,13 @@ data = {
38
  "job_description": "We are hiring a backend engineer..."
39
  }
40
 
41
- response = requests.post("https://yourdomain.com/api/rank-resumes", headers=headers, files=files, data=data)
42
  print(response.json())</code></pre>
43
 
44
- <h4>πŸ“¦ Sample Response</h4>
45
  <pre><code class="copyable">{
46
- "results": [
 
47
  {
48
  "filename": "cv2.pdf",
49
  "score": 0.8745
@@ -52,18 +54,17 @@ print(response.json())</code></pre>
52
  "filename": "cv1.pdf",
53
  "score": 0.6721
54
  }
55
- ],
56
- "count": 2,
57
- "requested_by": "user@example.com"
58
  }</code></pre>
59
 
60
  <hr class="my-5">
61
 
62
- <h4>πŸ§ͺ Try It Now</h4>
63
  <form method="POST" action="{{ url_for('auth.try_api') }}" enctype="multipart/form-data">
64
  <div class="mb-3">
65
  <label for="api_key" class="form-label">API Key</label>
66
- <input type="text" class="form-control" id="api_key" name="api_key" placeholder="amn=your_api_key_here" required>
 
67
  </div>
68
  <div class="mb-3">
69
  <label for="resumes" class="form-label">Upload Resumes (PDF)</label>
@@ -76,39 +77,38 @@ print(response.json())</code></pre>
76
  <button type="submit" class="btn btn-success">Submit Test Request</button>
77
  </form>
78
 
79
- {% if response is iterable and response[0] is mapping %}
80
  <hr class="my-5">
81
- <h5>πŸ“¬ API Response</h5>
82
  <table class="table table-striped">
83
  <thead>
84
  <tr><th>Filename</th><th>Score</th></tr>
85
  </thead>
86
  <tbody>
87
- {% for item in response %}
88
  <tr>
89
  <td>{{ item.filename }}</td>
90
- <td>{{ item.score }}</td>
91
  </tr>
92
  {% endfor %}
93
  </tbody>
94
  </table>
95
  {% elif response %}
96
  <hr class="my-5">
97
- <h5>πŸ“¬ API Response</h5>
98
- <pre><code>{{ response }}</code></pre>
99
  {% endif %}
100
 
101
  <p class="mt-4"><a href="{{ url_for('auth.dashboard') }}" class="btn btn-secondary">← Back to Dashboard</a></p>
102
 
103
- <!-- βœ… Copy Button Script -->
104
  <script>
105
  document.querySelectorAll('code.copyable').forEach(block => {
106
  const button = document.createElement('button');
107
  button.innerText = 'Copy';
108
  button.className = 'btn btn-sm btn-outline-primary mb-2 float-end';
109
  button.addEventListener('click', () => {
110
- const text = block.innerText;
111
- navigator.clipboard.writeText(text);
112
  button.innerText = 'Copied!';
113
  setTimeout(() => button.innerText = 'Copy', 1500);
114
  });
 
5
  <h2 class="mb-4">πŸ“˜ Resume Ranker API Documentation</h2>
6
 
7
  <h4>πŸ”— Endpoint</h4>
8
+ <pre><code class="copyable">POST https://rankapply-api.hf.space/rank-resumes</code></pre>
9
 
10
  <h4>πŸ” Authentication</h4>
11
  <p>Include your API key in the <code>Authorization</code> header:</p>
12
+ <pre><code class="copyable">Authorization: Bearer your_api_key_here</code></pre>
13
+ <p class="text-muted"><small>Never share your API key publicly. Treat it like a password.</small></p>
14
 
15
+ <h4>Request Parameters</h4>
16
  <ul>
17
  <li><strong>resumes</strong> (file[], required): One or more PDF resumes</li>
18
  <li><strong>job_description</strong> (text, required): The job description to match against</li>
19
  </ul>
20
 
21
+ <h4>πŸ“₯ Example Request (cURL)</h4>
22
+ <pre><code class="copyable">curl -X POST https://rankapply-api.hf.space/rank-resumes \
23
+ -H "Authorization: Bearer your_api_key_here" \
24
  -F "resumes=@cv1.pdf" \
25
  -F "resumes=@cv2.pdf" \
26
  -F "job_description=We are hiring a backend engineer..."</code></pre>
 
29
  <pre><code class="copyable">import requests
30
 
31
  headers = {
32
+ "Authorization": "Bearer your_api_key_here"
33
  }
34
  files = [
35
  ('resumes', ('cv1.pdf', open('cv1.pdf', 'rb'), 'application/pdf')),
 
39
  "job_description": "We are hiring a backend engineer..."
40
  }
41
 
42
+ response = requests.post("https://rankapply-api.hf.space/rank-resumes", headers=headers, files=files, data=data)
43
  print(response.json())</code></pre>
44
 
45
+ <h4> Sample Response</h4>
46
  <pre><code class="copyable">{
47
+ "job_description": "We are hiring a backend engineer...",
48
+ "ranked_resumes": [
49
  {
50
  "filename": "cv2.pdf",
51
  "score": 0.8745
 
54
  "filename": "cv1.pdf",
55
  "score": 0.6721
56
  }
57
+ ]
 
 
58
  }</code></pre>
59
 
60
  <hr class="my-5">
61
 
62
+ <h4> Try It Now</h4>
63
  <form method="POST" action="{{ url_for('auth.try_api') }}" enctype="multipart/form-data">
64
  <div class="mb-3">
65
  <label for="api_key" class="form-label">API Key</label>
66
+ <input type="text" class="form-control" id="api_key" name="api_key"
67
+ placeholder="your_api_key_here" required>
68
  </div>
69
  <div class="mb-3">
70
  <label for="resumes" class="form-label">Upload Resumes (PDF)</label>
 
77
  <button type="submit" class="btn btn-success">Submit Test Request</button>
78
  </form>
79
 
80
+ {% if response and response.ranked_resumes %}
81
  <hr class="my-5">
82
+ <h5> Ranked Results</h5>
83
  <table class="table table-striped">
84
  <thead>
85
  <tr><th>Filename</th><th>Score</th></tr>
86
  </thead>
87
  <tbody>
88
+ {% for item in response.ranked_resumes %}
89
  <tr>
90
  <td>{{ item.filename }}</td>
91
+ <td>{{ "%.4f"|format(item.score) }}</td>
92
  </tr>
93
  {% endfor %}
94
  </tbody>
95
  </table>
96
  {% elif response %}
97
  <hr class="my-5">
98
+ <h5> API Response</h5>
99
+ <pre><code>{{ response | tojson(indent=2) }}</code></pre>
100
  {% endif %}
101
 
102
  <p class="mt-4"><a href="{{ url_for('auth.dashboard') }}" class="btn btn-secondary">← Back to Dashboard</a></p>
103
 
104
+ <!-- Copy Button Script -->
105
  <script>
106
  document.querySelectorAll('code.copyable').forEach(block => {
107
  const button = document.createElement('button');
108
  button.innerText = 'Copy';
109
  button.className = 'btn btn-sm btn-outline-primary mb-2 float-end';
110
  button.addEventListener('click', () => {
111
+ navigator.clipboard.writeText(block.innerText);
 
112
  button.innerText = 'Copied!';
113
  setTimeout(() => button.innerText = 'Copy', 1500);
114
  });