Spaces:
Running
Running
up
Browse files
app.py
CHANGED
|
@@ -1069,10 +1069,9 @@ td:first-child code{white-space:nowrap;}
|
|
| 1069 |
|
| 1070 |
<h2>Endpoint</h2>
|
| 1071 |
<p><span class="badge method">POST</span> <code>https://bxrituxuhpc70w8w.us-east-1.aws.endpoints.huggingface.cloud</code></p>
|
| 1072 |
-
<p>The service runs on a Hugging Face Inference Endpoint.
|
| 1073 |
<pre><code>Accept: application/json
|
| 1074 |
-
Content-Type: application/json
|
| 1075 |
-
Authorization: Bearer YOUR_HF_TOKEN</code></pre>
|
| 1076 |
|
| 1077 |
<h2>Request body</h2>
|
| 1078 |
<table>
|
|
@@ -1126,13 +1125,11 @@ Authorization: Bearer YOUR_HF_TOKEN</code></pre>
|
|
| 1126 |
<pre><code>import requests
|
| 1127 |
|
| 1128 |
ENDPOINT = "https://bxrituxuhpc70w8w.us-east-1.aws.endpoints.huggingface.cloud"
|
| 1129 |
-
HF_TOKEN = "hf_your_token_here" # a token with access to the endpoint
|
| 1130 |
|
| 1131 |
def lean_finder(query, top_k=5, version="v4.28.0"):
|
| 1132 |
headers = {
|
| 1133 |
"Accept": "application/json",
|
| 1134 |
"Content-Type": "application/json",
|
| 1135 |
-
"Authorization": f"Bearer {HF_TOKEN}",
|
| 1136 |
}
|
| 1137 |
payload = {
|
| 1138 |
"inputs": query,
|
|
@@ -1161,12 +1158,10 @@ def lean_finder_retry(query, max_wait=300, **kwargs):
|
|
| 1161 |
if time.time() - start > max_wait:
|
| 1162 |
raise
|
| 1163 |
time.sleep(2) # endpoint is warming up, try again</code></pre>
|
| 1164 |
-
<div class="note">A 401 or 403 that keeps repeating means the token is missing or lacks access to the endpoint, not a cold start. Check your token first.</div>
|
| 1165 |
|
| 1166 |
<h2>curl example</h2>
|
| 1167 |
<pre><code>curl https://bxrituxuhpc70w8w.us-east-1.aws.endpoints.huggingface.cloud \
|
| 1168 |
-X POST \
|
| 1169 |
-
-H "Authorization: Bearer hf_your_token_here" \
|
| 1170 |
-H "Content-Type: application/json" \
|
| 1171 |
-d '{"inputs": "continuous function on a compact set is bounded above", "top_k": 5, "version": "v4.28.0"}'</code></pre>
|
| 1172 |
|
|
|
|
| 1069 |
|
| 1070 |
<h2>Endpoint</h2>
|
| 1071 |
<p><span class="badge method">POST</span> <code>https://bxrituxuhpc70w8w.us-east-1.aws.endpoints.huggingface.cloud</code></p>
|
| 1072 |
+
<p>The service runs on a Hugging Face Inference Endpoint. No token is required. Send a POST request with a JSON body and these headers:</p>
|
| 1073 |
<pre><code>Accept: application/json
|
| 1074 |
+
Content-Type: application/json</code></pre>
|
|
|
|
| 1075 |
|
| 1076 |
<h2>Request body</h2>
|
| 1077 |
<table>
|
|
|
|
| 1125 |
<pre><code>import requests
|
| 1126 |
|
| 1127 |
ENDPOINT = "https://bxrituxuhpc70w8w.us-east-1.aws.endpoints.huggingface.cloud"
|
|
|
|
| 1128 |
|
| 1129 |
def lean_finder(query, top_k=5, version="v4.28.0"):
|
| 1130 |
headers = {
|
| 1131 |
"Accept": "application/json",
|
| 1132 |
"Content-Type": "application/json",
|
|
|
|
| 1133 |
}
|
| 1134 |
payload = {
|
| 1135 |
"inputs": query,
|
|
|
|
| 1158 |
if time.time() - start > max_wait:
|
| 1159 |
raise
|
| 1160 |
time.sleep(2) # endpoint is warming up, try again</code></pre>
|
|
|
|
| 1161 |
|
| 1162 |
<h2>curl example</h2>
|
| 1163 |
<pre><code>curl https://bxrituxuhpc70w8w.us-east-1.aws.endpoints.huggingface.cloud \
|
| 1164 |
-X POST \
|
|
|
|
| 1165 |
-H "Content-Type: application/json" \
|
| 1166 |
-d '{"inputs": "continuous function on a compact set is bounded above", "top_k": 5, "version": "v4.28.0"}'</code></pre>
|
| 1167 |
|