Buckets:

rtrm's picture
download
raw
29 kB
import{s as Tt,o as dt,n as ot}from"../chunks/scheduler.f6b352c8.js";import{S as mt,i as ft,g as U,s as u,r as d,A as jt,h as T,f as n,c as p,j as gt,u as m,x as I,k as Ut,y as wt,a as o,v as f,d as j,t as w,w as q}from"../chunks/index.6149cea3.js";import{T as qt}from"../chunks/Tip.25311665.js";import{C as D}from"../chunks/CodeBlock.6f146ba5.js";import{I as It,M as it}from"../chunks/InferenceApi.5035f7e4.js";import{H as W,E as bt}from"../chunks/index.f7afb948.js";function $t(b){let s,r='For more details about the <code>table-question-answering</code> task, check out its <a href="https://huggingface.co/tasks/table-question-answering" rel="nofollow">dedicated page</a>! You will find examples and related materials.';return{c(){s=U("p"),s.innerHTML=r},l(e){s=T(e,"P",{"data-svelte-h":!0}),I(s)!=="svelte-hnlsr0"&&(s.innerHTML=r)},m(e,i){o(e,s,i)},p:ot,d(e){e&&n(s)}}}function kt(b){let s,r="Using <code>huggingface_hub</code>:",e,i,M,y,k="Using <code>requests</code>:",S,J,g,h,Q='To use the Python client, see <code>huggingface_hub</code>’s <a href="https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.table_question_answering" rel="nofollow">package reference</a>.',$;return i=new D({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEluZmVyZW5jZUNsaWVudCUwQSUwQWNsaWVudCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudCglMEElMDlwcm92aWRlciUzRCUyMmhmLWluZmVyZW5jZSUyMiUyQyUwQSUwOWFwaV9rZXklM0QlMjJoZl8qKiolMjIlMEEpJTBBJTBBcmVzdWx0JTIwJTNEJTIwY2xpZW50LnRhYmxlX3F1ZXN0aW9uX2Fuc3dlcmluZyglMEElMDltb2RlbCUzRCUyMm1pY3Jvc29mdCUyRnRhcGV4LWJhc2UlMjIlMkMlMEElMDlpbnB1dHMlM0QlN0IlMEElMDklMjJxdWVyeSUyMiUzQSUyMCUyMkhvdyUyMG1hbnklMjBzdGFycyUyMGRvZXMlMjB0aGUlMjB0cmFuc2Zvcm1lcnMlMjByZXBvc2l0b3J5JTIwaGF2ZSUzRiUyMiUyQyUwQSUwOSUyMnRhYmxlJTIyJTNBJTIwJTdCJTBBJTA5JTA5JTIyUmVwb3NpdG9yeSUyMiUzQSUyMCU1QiUyMlRyYW5zZm9ybWVycyUyMiUyQyUyMCUyMkRhdGFzZXRzJTIyJTJDJTIwJTIyVG9rZW5pemVycyUyMiU1RCUyQyUwQSUwOSUwOSUyMlN0YXJzJTIyJTNBJTIwJTVCJTIyMzY1NDIlMjIlMkMlMjAlMjI0NTEyJTIyJTJDJTIwJTIyMzkzNCUyMiU1RCUyQyUwQSUwOSUwOSUyMkNvbnRyaWJ1dG9ycyUyMiUzQSUyMCU1QiUyMjY1MSUyMiUyQyUyMCUyMjc3JTIyJTJDJTIwJTIyMzQlMjIlNUQlMkMlMEElMDklMDklMjJQcm9ncmFtbWluZyUyMGxhbmd1YWdlJTIyJTNBJTIwJTVCJTBBJTA5JTA5JTA5JTIyUHl0aG9uJTIyJTJDJTBBJTA5JTA5JTA5JTIyUHl0aG9uJTIyJTJDJTBBJTA5JTA5JTA5JTIyUnVzdCUyQyUyMFB5dGhvbiUyMGFuZCUyME5vZGVKUyUyMiUwQSUwOSUwOSU1RCUwQSUwOSU3RCUwQSU3RCUyQyUwQSUwOXByb3ZpZGVyJTNEJTIyaGYtaW5mZXJlbmNlJTIyJTJDJTBBKSUwQSUwQXByaW50KHJlc3VsdCklMEE=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient
client = InferenceClient(
provider=<span class="hljs-string">&quot;hf-inference&quot;</span>,
api_key=<span class="hljs-string">&quot;hf_***&quot;</span>
)
result = client.table_question_answering(
model=<span class="hljs-string">&quot;microsoft/tapex-base&quot;</span>,
inputs={
<span class="hljs-string">&quot;query&quot;</span>: <span class="hljs-string">&quot;How many stars does the transformers repository have?&quot;</span>,
<span class="hljs-string">&quot;table&quot;</span>: {
<span class="hljs-string">&quot;Repository&quot;</span>: [<span class="hljs-string">&quot;Transformers&quot;</span>, <span class="hljs-string">&quot;Datasets&quot;</span>, <span class="hljs-string">&quot;Tokenizers&quot;</span>],
<span class="hljs-string">&quot;Stars&quot;</span>: [<span class="hljs-string">&quot;36542&quot;</span>, <span class="hljs-string">&quot;4512&quot;</span>, <span class="hljs-string">&quot;3934&quot;</span>],
<span class="hljs-string">&quot;Contributors&quot;</span>: [<span class="hljs-string">&quot;651&quot;</span>, <span class="hljs-string">&quot;77&quot;</span>, <span class="hljs-string">&quot;34&quot;</span>],
<span class="hljs-string">&quot;Programming language&quot;</span>: [
<span class="hljs-string">&quot;Python&quot;</span>,
<span class="hljs-string">&quot;Python&quot;</span>,
<span class="hljs-string">&quot;Rust, Python and NodeJS&quot;</span>
]
}
},
provider=<span class="hljs-string">&quot;hf-inference&quot;</span>,
)
<span class="hljs-built_in">print</span>(result)
`,wrap:!1}}),J=new D({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEElMEFBUElfVVJMJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZyb3V0ZXIuaHVnZ2luZ2ZhY2UuY28lMkZoZi1pbmZlcmVuY2UlMkZ2MSUyMiUwQWhlYWRlcnMlMjAlM0QlMjAlN0IlMjJBdXRob3JpemF0aW9uJTIyJTNBJTIwJTIyQmVhcmVyJTIwaGZfKioqJTIyJTdEJTBBJTBBZGVmJTIwcXVlcnkocGF5bG9hZCklM0ElMEElMDlyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLnBvc3QoQVBJX1VSTCUyQyUyMGhlYWRlcnMlM0RoZWFkZXJzJTJDJTIwanNvbiUzRHBheWxvYWQpJTBBJTA5cmV0dXJuJTIwcmVzcG9uc2UuanNvbigpJTBBJTA5JTBBb3V0cHV0JTIwJTNEJTIwcXVlcnkoJTdCJTBBJTA5JTIyaW5wdXRzJTIyJTNBJTIwJTdCJTBBJTA5JTIycXVlcnklMjIlM0ElMjAlMjJIb3clMjBtYW55JTIwc3RhcnMlMjBkb2VzJTIwdGhlJTIwdHJhbnNmb3JtZXJzJTIwcmVwb3NpdG9yeSUyMGhhdmUlM0YlMjIlMkMlMEElMDklMjJ0YWJsZSUyMiUzQSUyMCU3QiUwQSUwOSUwOSUyMlJlcG9zaXRvcnklMjIlM0ElMjAlNUIlMjJUcmFuc2Zvcm1lcnMlMjIlMkMlMjAlMjJEYXRhc2V0cyUyMiUyQyUyMCUyMlRva2VuaXplcnMlMjIlNUQlMkMlMEElMDklMDklMjJTdGFycyUyMiUzQSUyMCU1QiUyMjM2NTQyJTIyJTJDJTIwJTIyNDUxMiUyMiUyQyUyMCUyMjM5MzQlMjIlNUQlMkMlMEElMDklMDklMjJDb250cmlidXRvcnMlMjIlM0ElMjAlNUIlMjI2NTElMjIlMkMlMjAlMjI3NyUyMiUyQyUyMCUyMjM0JTIyJTVEJTJDJTBBJTA5JTA5JTIyUHJvZ3JhbW1pbmclMjBsYW5ndWFnZSUyMiUzQSUyMCU1QiUwQSUwOSUwOSUwOSUyMlB5dGhvbiUyMiUyQyUwQSUwOSUwOSUwOSUyMlB5dGhvbiUyMiUyQyUwQSUwOSUwOSUwOSUyMlJ1c3QlMkMlMjBQeXRob24lMjBhbmQlMjBOb2RlSlMlMjIlMEElMDklMDklNUQlMEElMDklN0QlMEElN0QlMkMlMEElN0Qp",highlighted:`<span class="hljs-keyword">import</span> requests
API_URL = <span class="hljs-string">&quot;https://router.huggingface.co/hf-inference/v1&quot;</span>
headers = {<span class="hljs-string">&quot;Authorization&quot;</span>: <span class="hljs-string">&quot;Bearer hf_***&quot;</span>}
<span class="hljs-keyword">def</span> <span class="hljs-title function_">query</span>(<span class="hljs-params">payload</span>):
response = requests.post(API_URL, headers=headers, json=payload)
<span class="hljs-keyword">return</span> response.json()
output = query({
<span class="hljs-string">&quot;inputs&quot;</span>: {
<span class="hljs-string">&quot;query&quot;</span>: <span class="hljs-string">&quot;How many stars does the transformers repository have?&quot;</span>,
<span class="hljs-string">&quot;table&quot;</span>: {
<span class="hljs-string">&quot;Repository&quot;</span>: [<span class="hljs-string">&quot;Transformers&quot;</span>, <span class="hljs-string">&quot;Datasets&quot;</span>, <span class="hljs-string">&quot;Tokenizers&quot;</span>],
<span class="hljs-string">&quot;Stars&quot;</span>: [<span class="hljs-string">&quot;36542&quot;</span>, <span class="hljs-string">&quot;4512&quot;</span>, <span class="hljs-string">&quot;3934&quot;</span>],
<span class="hljs-string">&quot;Contributors&quot;</span>: [<span class="hljs-string">&quot;651&quot;</span>, <span class="hljs-string">&quot;77&quot;</span>, <span class="hljs-string">&quot;34&quot;</span>],
<span class="hljs-string">&quot;Programming language&quot;</span>: [
<span class="hljs-string">&quot;Python&quot;</span>,
<span class="hljs-string">&quot;Python&quot;</span>,
<span class="hljs-string">&quot;Rust, Python and NodeJS&quot;</span>
]
}
},
})`,wrap:!1}}),{c(){s=U("p"),s.innerHTML=r,e=u(),d(i.$$.fragment),M=u(),y=U("p"),y.innerHTML=k,S=u(),d(J.$$.fragment),g=u(),h=U("p"),h.innerHTML=Q},l(l){s=T(l,"P",{"data-svelte-h":!0}),I(s)!=="svelte-chb6bp"&&(s.innerHTML=r),e=p(l),m(i.$$.fragment,l),M=p(l),y=T(l,"P",{"data-svelte-h":!0}),I(y)!=="svelte-1v1c44h"&&(y.innerHTML=k),S=p(l),m(J.$$.fragment,l),g=p(l),h=T(l,"P",{"data-svelte-h":!0}),I(h)!=="svelte-fn0318"&&(h.innerHTML=Q)},m(l,c){o(l,s,c),o(l,e,c),f(i,l,c),o(l,M,c),o(l,y,c),o(l,S,c),f(J,l,c),o(l,g,c),o(l,h,c),$=!0},p:ot,i(l){$||(j(i.$$.fragment,l),j(J.$$.fragment,l),$=!0)},o(l){w(i.$$.fragment,l),w(J.$$.fragment,l),$=!1},d(l){l&&(n(s),n(e),n(M),n(y),n(S),n(g),n(h)),q(i,l),q(J,l)}}}function Qt(b){let s,r;return s=new it({props:{$$slots:{default:[kt]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment)},l(e){m(s.$$.fragment,e)},m(e,i){f(s,e,i),r=!0},p(e,i){const M={};i&2&&(M.$$scope={dirty:i,ctx:e}),s.$set(M)},i(e){r||(j(s.$$.fragment,e),r=!0)},o(e){w(s.$$.fragment,e),r=!1},d(e){q(s,e)}}}function St(b){let s,r="Using <code>huggingface.js</code>:",e,i,M,y,k="Using <code>fetch</code>:",S,J,g,h,Q='To use the JavaScript client, see <code>huggingface.js</code>’s <a href="https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#tablequestionanswering" rel="nofollow">package reference</a>.',$;return i=new D({props:{code:"aW1wb3J0JTIwJTdCJTIwSGZJbmZlcmVuY2UlMjAlN0QlMjBmcm9tJTIwJTIyJTQwaHVnZ2luZ2ZhY2UlMkZpbmZlcmVuY2UlMjIlM0IlMEElMEFjb25zdCUyMGNsaWVudCUyMCUzRCUyMG5ldyUyMEhmSW5mZXJlbmNlKCUyMmhmXyoqKiUyMiklM0IlMEElMEFjb25zdCUyMG91dHB1dCUyMCUzRCUyMGF3YWl0JTIwY2xpZW50LnRhYmxlUXVlc3Rpb25BbnN3ZXJpbmcoJTdCJTBBJTA5bW9kZWwlM0ElMjAlMjJtaWNyb3NvZnQlMkZ0YXBleC1iYXNlJTIyJTJDJTBBJTA5aW5wdXRzJTNBJTIwJTdCJTBBJTA5JTIycXVlcnklMjIlM0ElMjAlMjJIb3clMjBtYW55JTIwc3RhcnMlMjBkb2VzJTIwdGhlJTIwdHJhbnNmb3JtZXJzJTIwcmVwb3NpdG9yeSUyMGhhdmUlM0YlMjIlMkMlMEElMDklMjJ0YWJsZSUyMiUzQSUyMCU3QiUwQSUwOSUwOSUyMlJlcG9zaXRvcnklMjIlM0ElMjAlNUIlMjJUcmFuc2Zvcm1lcnMlMjIlMkMlMjAlMjJEYXRhc2V0cyUyMiUyQyUyMCUyMlRva2VuaXplcnMlMjIlNUQlMkMlMEElMDklMDklMjJTdGFycyUyMiUzQSUyMCU1QiUyMjM2NTQyJTIyJTJDJTIwJTIyNDUxMiUyMiUyQyUyMCUyMjM5MzQlMjIlNUQlMkMlMEElMDklMDklMjJDb250cmlidXRvcnMlMjIlM0ElMjAlNUIlMjI2NTElMjIlMkMlMjAlMjI3NyUyMiUyQyUyMCUyMjM0JTIyJTVEJTJDJTBBJTA5JTA5JTIyUHJvZ3JhbW1pbmclMjBsYW5ndWFnZSUyMiUzQSUyMCU1QiUwQSUwOSUwOSUwOSUyMlB5dGhvbiUyMiUyQyUwQSUwOSUwOSUwOSUyMlB5dGhvbiUyMiUyQyUwQSUwOSUwOSUwOSUyMlJ1c3QlMkMlMjBQeXRob24lMjBhbmQlMjBOb2RlSlMlMjIlMEElMDklMDklNUQlMEElMDklN0QlMEElN0QlMkMlMEElMDlwcm92aWRlciUzQSUyMCUyMmhmLWluZmVyZW5jZSUyMiUyQyUwQSU3RCklM0IlMEElMEFjb25zb2xlLmxvZyhvdXRwdXQpJTNCJTBB",highlighted:`<span class="hljs-keyword">import</span> { <span class="hljs-title class_">HfInference</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;@huggingface/inference&quot;</span>;
<span class="hljs-keyword">const</span> client = <span class="hljs-keyword">new</span> <span class="hljs-title class_">HfInference</span>(<span class="hljs-string">&quot;hf_***&quot;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> client.<span class="hljs-title function_">tableQuestionAnswering</span>({
<span class="hljs-attr">model</span>: <span class="hljs-string">&quot;microsoft/tapex-base&quot;</span>,
<span class="hljs-attr">inputs</span>: {
<span class="hljs-string">&quot;query&quot;</span>: <span class="hljs-string">&quot;How many stars does the transformers repository have?&quot;</span>,
<span class="hljs-string">&quot;table&quot;</span>: {
<span class="hljs-string">&quot;Repository&quot;</span>: [<span class="hljs-string">&quot;Transformers&quot;</span>, <span class="hljs-string">&quot;Datasets&quot;</span>, <span class="hljs-string">&quot;Tokenizers&quot;</span>],
<span class="hljs-string">&quot;Stars&quot;</span>: [<span class="hljs-string">&quot;36542&quot;</span>, <span class="hljs-string">&quot;4512&quot;</span>, <span class="hljs-string">&quot;3934&quot;</span>],
<span class="hljs-string">&quot;Contributors&quot;</span>: [<span class="hljs-string">&quot;651&quot;</span>, <span class="hljs-string">&quot;77&quot;</span>, <span class="hljs-string">&quot;34&quot;</span>],
<span class="hljs-string">&quot;Programming language&quot;</span>: [
<span class="hljs-string">&quot;Python&quot;</span>,
<span class="hljs-string">&quot;Python&quot;</span>,
<span class="hljs-string">&quot;Rust, Python and NodeJS&quot;</span>
]
}
},
<span class="hljs-attr">provider</span>: <span class="hljs-string">&quot;hf-inference&quot;</span>,
});
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(output);
`,wrap:!1}}),J=new D({props:{code:"YXN5bmMlMjBmdW5jdGlvbiUyMHF1ZXJ5KGRhdGEpJTIwJTdCJTBBJTA5Y29uc3QlMjByZXNwb25zZSUyMCUzRCUyMGF3YWl0JTIwZmV0Y2goJTBBJTA5JTA5JTIyaHR0cHMlM0ElMkYlMkZyb3V0ZXIuaHVnZ2luZ2ZhY2UuY28lMkZoZi1pbmZlcmVuY2UlMkZtb2RlbHMlMkZtaWNyb3NvZnQlMkZ0YXBleC1iYXNlJTIyJTJDJTBBJTA5JTA5JTdCJTBBJTA5JTA5JTA5aGVhZGVycyUzQSUyMCU3QiUwQSUwOSUwOSUwOSUwOUF1dGhvcml6YXRpb24lM0ElMjAlMjJCZWFyZXIlMjBoZl8qKiolMjIlMkMlMEElMDklMDklMDklMDklMjJDb250ZW50LVR5cGUlMjIlM0ElMjAlMjJhcHBsaWNhdGlvbiUyRmpzb24lMjIlMkMlMEElMDklMDklMDklN0QlMkMlMEElMDklMDklMDltZXRob2QlM0ElMjAlMjJQT1NUJTIyJTJDJTBBJTA5JTA5JTA5Ym9keSUzQSUyMEpTT04uc3RyaW5naWZ5KGRhdGEpJTJDJTBBJTA5JTA5JTdEJTBBJTA5KSUzQiUwQSUwOWNvbnN0JTIwcmVzdWx0JTIwJTNEJTIwYXdhaXQlMjByZXNwb25zZS5qc29uKCklM0IlMEElMDlyZXR1cm4lMjByZXN1bHQlM0IlMEElN0QlMEElMEFxdWVyeSglN0IlMjJpbnB1dHMlMjIlM0ElMjAlN0IlMEElMDklMjJxdWVyeSUyMiUzQSUyMCUyMkhvdyUyMG1hbnklMjBzdGFycyUyMGRvZXMlMjB0aGUlMjB0cmFuc2Zvcm1lcnMlMjByZXBvc2l0b3J5JTIwaGF2ZSUzRiUyMiUyQyUwQSUwOSUyMnRhYmxlJTIyJTNBJTIwJTdCJTBBJTA5JTA5JTIyUmVwb3NpdG9yeSUyMiUzQSUyMCU1QiUyMlRyYW5zZm9ybWVycyUyMiUyQyUyMCUyMkRhdGFzZXRzJTIyJTJDJTIwJTIyVG9rZW5pemVycyUyMiU1RCUyQyUwQSUwOSUwOSUyMlN0YXJzJTIyJTNBJTIwJTVCJTIyMzY1NDIlMjIlMkMlMjAlMjI0NTEyJTIyJTJDJTIwJTIyMzkzNCUyMiU1RCUyQyUwQSUwOSUwOSUyMkNvbnRyaWJ1dG9ycyUyMiUzQSUyMCU1QiUyMjY1MSUyMiUyQyUyMCUyMjc3JTIyJTJDJTIwJTIyMzQlMjIlNUQlMkMlMEElMDklMDklMjJQcm9ncmFtbWluZyUyMGxhbmd1YWdlJTIyJTNBJTIwJTVCJTBBJTA5JTA5JTA5JTIyUHl0aG9uJTIyJTJDJTBBJTA5JTA5JTA5JTIyUHl0aG9uJTIyJTJDJTBBJTA5JTA5JTA5JTIyUnVzdCUyQyUyMFB5dGhvbiUyMGFuZCUyME5vZGVKUyUyMiUwQSUwOSUwOSU1RCUwQSUwOSU3RCUwQSU3RCU3RCkudGhlbigocmVzcG9uc2UpJTIwJTNEJTNFJTIwJTdCJTBBJTA5Y29uc29sZS5sb2coSlNPTi5zdHJpbmdpZnkocmVzcG9uc2UpKSUzQiUwQSU3RCklM0I=",highlighted:`<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">query</span>(<span class="hljs-params">data</span>) {
<span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> <span class="hljs-title function_">fetch</span>(
<span class="hljs-string">&quot;https://router.huggingface.co/hf-inference/models/microsoft/tapex-base&quot;</span>,
{
<span class="hljs-attr">headers</span>: {
<span class="hljs-title class_">Authorization</span>: <span class="hljs-string">&quot;Bearer hf_***&quot;</span>,
<span class="hljs-string">&quot;Content-Type&quot;</span>: <span class="hljs-string">&quot;application/json&quot;</span>,
},
<span class="hljs-attr">method</span>: <span class="hljs-string">&quot;POST&quot;</span>,
<span class="hljs-attr">body</span>: <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>(data),
}
);
<span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> response.<span class="hljs-title function_">json</span>();
<span class="hljs-keyword">return</span> result;
}
<span class="hljs-title function_">query</span>({<span class="hljs-string">&quot;inputs&quot;</span>: {
<span class="hljs-string">&quot;query&quot;</span>: <span class="hljs-string">&quot;How many stars does the transformers repository have?&quot;</span>,
<span class="hljs-string">&quot;table&quot;</span>: {
<span class="hljs-string">&quot;Repository&quot;</span>: [<span class="hljs-string">&quot;Transformers&quot;</span>, <span class="hljs-string">&quot;Datasets&quot;</span>, <span class="hljs-string">&quot;Tokenizers&quot;</span>],
<span class="hljs-string">&quot;Stars&quot;</span>: [<span class="hljs-string">&quot;36542&quot;</span>, <span class="hljs-string">&quot;4512&quot;</span>, <span class="hljs-string">&quot;3934&quot;</span>],
<span class="hljs-string">&quot;Contributors&quot;</span>: [<span class="hljs-string">&quot;651&quot;</span>, <span class="hljs-string">&quot;77&quot;</span>, <span class="hljs-string">&quot;34&quot;</span>],
<span class="hljs-string">&quot;Programming language&quot;</span>: [
<span class="hljs-string">&quot;Python&quot;</span>,
<span class="hljs-string">&quot;Python&quot;</span>,
<span class="hljs-string">&quot;Rust, Python and NodeJS&quot;</span>
]
}
}}).<span class="hljs-title function_">then</span>(<span class="hljs-function">(<span class="hljs-params">response</span>) =&gt;</span> {
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>(response));
});`,wrap:!1}}),{c(){s=U("p"),s.innerHTML=r,e=u(),d(i.$$.fragment),M=u(),y=U("p"),y.innerHTML=k,S=u(),d(J.$$.fragment),g=u(),h=U("p"),h.innerHTML=Q},l(l){s=T(l,"P",{"data-svelte-h":!0}),I(s)!=="svelte-1g5hu6q"&&(s.innerHTML=r),e=p(l),m(i.$$.fragment,l),M=p(l),y=T(l,"P",{"data-svelte-h":!0}),I(y)!=="svelte-wea1gb"&&(y.innerHTML=k),S=p(l),m(J.$$.fragment,l),g=p(l),h=T(l,"P",{"data-svelte-h":!0}),I(h)!=="svelte-45s3fv"&&(h.innerHTML=Q)},m(l,c){o(l,s,c),o(l,e,c),f(i,l,c),o(l,M,c),o(l,y,c),o(l,S,c),f(J,l,c),o(l,g,c),o(l,h,c),$=!0},p:ot,i(l){$||(j(i.$$.fragment,l),j(J.$$.fragment,l),$=!0)},o(l){w(i.$$.fragment,l),w(J.$$.fragment,l),$=!1},d(l){l&&(n(s),n(e),n(M),n(y),n(S),n(g),n(h)),q(i,l),q(J,l)}}}function Bt(b){let s,r;return s=new it({props:{$$slots:{default:[St]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment)},l(e){m(s.$$.fragment,e)},m(e,i){f(s,e,i),r=!0},p(e,i){const M={};i&2&&(M.$$scope={dirty:i,ctx:e}),s.$set(M)},i(e){r||(j(s.$$.fragment,e),r=!0)},o(e){w(s.$$.fragment,e),r=!1},d(e){q(s,e)}}}function Ct(b){let s,r;return s=new D({props:{code:"Y3VybCUyMGh0dHBzJTNBJTJGJTJGcm91dGVyLmh1Z2dpbmdmYWNlLmNvJTJGaGYtaW5mZXJlbmNlJTJGbW9kZWxzJTJGbWljcm9zb2Z0JTJGdGFwZXgtYmFzZSUyMCU1QyUwQSUwOS1YJTIwUE9TVCUyMCU1QyUwQSUwOS1kJTIwJyU3QiUyMmlucHV0cyUyMiUzQSUyMCU3QiUyMCUyMnF1ZXJ5JTIyJTNBJTIwJTIySG93JTIwbWFueSUyMHN0YXJzJTIwZG9lcyUyMHRoZSUyMHRyYW5zZm9ybWVycyUyMHJlcG9zaXRvcnklMjBoYXZlJTNGJTIyJTJDJTIwJTIydGFibGUlMjIlM0ElMjAlN0IlMjAlMjJSZXBvc2l0b3J5JTIyJTNBJTIwJTVCJTIyVHJhbnNmb3JtZXJzJTIyJTJDJTIwJTIyRGF0YXNldHMlMjIlMkMlMjAlMjJUb2tlbml6ZXJzJTIyJTVEJTJDJTIwJTIyU3RhcnMlMjIlM0ElMjAlNUIlMjIzNjU0MiUyMiUyQyUyMCUyMjQ1MTIlMjIlMkMlMjAlMjIzOTM0JTIyJTVEJTJDJTIwJTIyQ29udHJpYnV0b3JzJTIyJTNBJTIwJTVCJTIyNjUxJTIyJTJDJTIwJTIyNzclMjIlMkMlMjAlMjIzNCUyMiU1RCUyQyUyMCUyMlByb2dyYW1taW5nJTIwbGFuZ3VhZ2UlMjIlM0ElMjAlNUIlMjAlMjJQeXRob24lMjIlMkMlMjAlMjJQeXRob24lMjIlMkMlMjAlMjJSdXN0JTJDJTIwUHl0aG9uJTIwYW5kJTIwTm9kZUpTJTIyJTIwJTVEJTIwJTdEJTIwJTdEJTdEJyUyMCU1QyUwQSUwOS1IJTIwJ0NvbnRlbnQtVHlwZSUzQSUyMGFwcGxpY2F0aW9uJTJGanNvbiclMjAlNUMlMEElMDktSCUyMCdBdXRob3JpemF0aW9uJTNBJTIwQmVhcmVyJTIwaGZfKioqJw==",highlighted:`curl https://router.huggingface.co/hf-inference/models/microsoft/tapex-base \\
-X POST \\
-d <span class="hljs-string">&#x27;{&quot;inputs&quot;: { &quot;query&quot;: &quot;How many stars does the transformers repository have?&quot;, &quot;table&quot;: { &quot;Repository&quot;: [&quot;Transformers&quot;, &quot;Datasets&quot;, &quot;Tokenizers&quot;], &quot;Stars&quot;: [&quot;36542&quot;, &quot;4512&quot;, &quot;3934&quot;], &quot;Contributors&quot;: [&quot;651&quot;, &quot;77&quot;, &quot;34&quot;], &quot;Programming language&quot;: [ &quot;Python&quot;, &quot;Python&quot;, &quot;Rust, Python and NodeJS&quot; ] } }}&#x27;</span> \\
-H <span class="hljs-string">&#x27;Content-Type: application/json&#x27;</span> \\
-H <span class="hljs-string">&#x27;Authorization: Bearer hf_***&#x27;</span>`,wrap:!1}}),{c(){d(s.$$.fragment)},l(e){m(s.$$.fragment,e)},m(e,i){f(s,e,i),r=!0},p:ot,i(e){r||(j(s.$$.fragment,e),r=!0)},o(e){w(s.$$.fragment,e),r=!1},d(e){q(s,e)}}}function Et(b){let s,r;return s=new it({props:{$$slots:{default:[Ct]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment)},l(e){m(s.$$.fragment,e)},m(e,i){f(s,e,i),r=!0},p(e,i){const M={};i&2&&(M.$$scope={dirty:i,ctx:e}),s.$set(M)},i(e){r||(j(s.$$.fragment,e),r=!0)},o(e){w(s.$$.fragment,e),r=!1},d(e){q(s,e)}}}function Zt(b){let s,r,e,i,M,y,k,S="Table Question Answering (Table QA) is the answering a question about an information on a given table.",J,g,h,Q,$,l,c='<li><a href="https://huggingface.co/microsoft/tapex-base" rel="nofollow">microsoft/tapex-base</a>: A table question answering model that is capable of neural SQL execution, i.e., employ TAPEX to execute a SQL query on a given table.</li> <li><a href="https://huggingface.co/google/tapas-base-finetuned-wtq" rel="nofollow">google/tapas-base-finetuned-wtq</a>: A robust table question answering model.</li>',X,C,rt='Explore all available models and find the one that suits you best <a href="https://huggingface.co/models?inference=warm&amp;pipeline_tag=table-question-answering&amp;sort=trending" rel="nofollow">here</a>.',Y,E,x,B,O,Z,P,N,F,v,ut='<thead><tr><th align="left">Payload</th> <th align="left"></th> <th align="left"></th></tr></thead> <tbody><tr><td align="left"><strong>inputs*</strong></td> <td align="left"><em>object</em></td> <td align="left">One (table, question) pair to answer</td></tr> <tr><td align="left"><strong>        table*</strong></td> <td align="left"><em>object</em></td> <td align="left">The table to serve as context for the questions</td></tr> <tr><td align="left"><strong>        question*</strong></td> <td align="left"><em>string</em></td> <td align="left">The question to be answered about the table</td></tr> <tr><td align="left"><strong>parameters</strong></td> <td align="left"><em>object</em></td> <td align="left"></td></tr> <tr><td align="left"><strong>        padding</strong></td> <td align="left"><em>enum</em></td> <td align="left">Possible values: do_not_pad, longest, max_length.</td></tr> <tr><td align="left"><strong>        sequential</strong></td> <td align="left"><em>boolean</em></td> <td align="left">Whether to do inference sequentially or as a batch. Batching is faster, but models like SQA require the inference to be done sequentially to extract relations within sequences, given their conversational nature.</td></tr> <tr><td align="left"><strong>        truncation</strong></td> <td align="left"><em>boolean</em></td> <td align="left">Activates and controls truncation.</td></tr></tbody>',L,A,pt="Some options can be configured by passing headers to the Inference API. Here are the available headers:",K,R,Mt='<thead><tr><th align="left">Headers</th> <th align="left"></th> <th align="left"></th></tr></thead> <tbody><tr><td align="left"><strong>authorization</strong></td> <td align="left"><em>string</em></td> <td align="left">Authentication header in the form <code>&#39;Bearer: hf_****&#39;</code> when <code>hf_****</code> is a personal user access token with Inference API permission. You can generate one from <a href="https://huggingface.co/settings/tokens" rel="nofollow">your settings page</a>.</td></tr> <tr><td align="left"><strong>x-use-cache</strong></td> <td align="left"><em>boolean, default to <code>true</code></em></td> <td align="left">There is a cache layer on the inference API to speed up requests we have already seen. Most models can use those results as they are deterministic (meaning the outputs will be the same anyway). However, if you use a nondeterministic model, you can set this parameter to prevent the caching mechanism from being used, resulting in a real new query. Read more about caching <a href="../parameters#caching%5D">here</a>.</td></tr> <tr><td align="left"><strong>x-wait-for-model</strong></td> <td align="left"><em>boolean, default to <code>false</code></em></td> <td align="left">If the model is not ready, wait for it instead of receiving 503. It limits the number of requests required to get your inference done. It is advised to only set this flag to true after receiving a 503 error, as it will limit hanging in your application to known places. Read more about model availability <a href="../overview#eligibility%5D">here</a>.</td></tr></tbody>',tt,G,ct='For more information about Inference API headers, check out the parameters <a href="../parameters">guide</a>.',st,z,et,_,yt='<thead><tr><th align="left">Body</th> <th align="left"></th> <th align="left"></th></tr></thead> <tbody><tr><td align="left"><strong>(array)</strong></td> <td align="left"><em>object[]</em></td> <td align="left">Output is an array of objects.</td></tr> <tr><td align="left"><strong>        answer</strong></td> <td align="left"><em>string</em></td> <td align="left">The answer of the question given the table. If there is an aggregator, the answer will be preceded by <code>AGGREGATOR &gt;</code>.</td></tr> <tr><td align="left"><strong>        coordinates</strong></td> <td align="left"><em>array[]</em></td> <td align="left">Coordinates of the cells of the answers.</td></tr> <tr><td align="left"><strong>        cells</strong></td> <td align="left"><em>string[]</em></td> <td align="left">List of strings made up of the answer cell values.</td></tr> <tr><td align="left"><strong>        aggregator</strong></td> <td align="left"><em>string</em></td> <td align="left">If the model has an aggregator, this returns the aggregator.</td></tr></tbody>',lt,V,nt,H,at;return M=new W({props:{title:"Table Question Answering",local:"table-question-answering",headingTag:"h2"}}),g=new qt({props:{$$slots:{default:[$t]},$$scope:{ctx:b}}}),Q=new W({props:{title:"Recommended models",local:"recommended-models",headingTag:"h3"}}),E=new W({props:{title:"Using the API",local:"using-the-api",headingTag:"h3"}}),B=new It({props:{python:!0,js:!0,curl:!0,$$slots:{curl:[Et],js:[Bt],python:[Qt]},$$scope:{ctx:b}}}),Z=new W({props:{title:"API specification",local:"api-specification",headingTag:"h3"}}),N=new W({props:{title:"Request",local:"request",headingTag:"h4"}}),z=new W({props:{title:"Response",local:"response",headingTag:"h4"}}),V=new bt({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/inference-providers/tasks/table-question-answering.md"}}),{c(){s=U("meta"),r=u(),e=U("p"),i=u(),d(M.$$.fragment),y=u(),k=U("p"),k.textContent=S,J=u(),d(g.$$.fragment),h=u(),d(Q.$$.fragment),$=u(),l=U("ul"),l.innerHTML=c,X=u(),C=U("p"),C.innerHTML=rt,Y=u(),d(E.$$.fragment),x=u(),d(B.$$.fragment),O=u(),d(Z.$$.fragment),P=u(),d(N.$$.fragment),F=u(),v=U("table"),v.innerHTML=ut,L=u(),A=U("p"),A.textContent=pt,K=u(),R=U("table"),R.innerHTML=Mt,tt=u(),G=U("p"),G.innerHTML=ct,st=u(),d(z.$$.fragment),et=u(),_=U("table"),_.innerHTML=yt,lt=u(),d(V.$$.fragment),nt=u(),H=U("p"),this.h()},l(t){const a=jt("svelte-u9bgzb",document.head);s=T(a,"META",{name:!0,content:!0}),a.forEach(n),r=p(t),e=T(t,"P",{}),gt(e).forEach(n),i=p(t),m(M.$$.fragment,t),y=p(t),k=T(t,"P",{"data-svelte-h":!0}),I(k)!=="svelte-1h902ra"&&(k.textContent=S),J=p(t),m(g.$$.fragment,t),h=p(t),m(Q.$$.fragment,t),$=p(t),l=T(t,"UL",{"data-svelte-h":!0}),I(l)!=="svelte-1jox8hm"&&(l.innerHTML=c),X=p(t),C=T(t,"P",{"data-svelte-h":!0}),I(C)!=="svelte-1hakgjj"&&(C.innerHTML=rt),Y=p(t),m(E.$$.fragment,t),x=p(t),m(B.$$.fragment,t),O=p(t),m(Z.$$.fragment,t),P=p(t),m(N.$$.fragment,t),F=p(t),v=T(t,"TABLE",{"data-svelte-h":!0}),I(v)!=="svelte-11w5q36"&&(v.innerHTML=ut),L=p(t),A=T(t,"P",{"data-svelte-h":!0}),I(A)!=="svelte-xa4wks"&&(A.textContent=pt),K=p(t),R=T(t,"TABLE",{"data-svelte-h":!0}),I(R)!=="svelte-2rfiu7"&&(R.innerHTML=Mt),tt=p(t),G=T(t,"P",{"data-svelte-h":!0}),I(G)!=="svelte-1ps9cb1"&&(G.innerHTML=ct),st=p(t),m(z.$$.fragment,t),et=p(t),_=T(t,"TABLE",{"data-svelte-h":!0}),I(_)!=="svelte-1u8ol55"&&(_.innerHTML=yt),lt=p(t),m(V.$$.fragment,t),nt=p(t),H=T(t,"P",{}),gt(H).forEach(n),this.h()},h(){Ut(s,"name","hf:doc:metadata"),Ut(s,"content",Nt)},m(t,a){wt(document.head,s),o(t,r,a),o(t,e,a),o(t,i,a),f(M,t,a),o(t,y,a),o(t,k,a),o(t,J,a),f(g,t,a),o(t,h,a),f(Q,t,a),o(t,$,a),o(t,l,a),o(t,X,a),o(t,C,a),o(t,Y,a),f(E,t,a),o(t,x,a),f(B,t,a),o(t,O,a),f(Z,t,a),o(t,P,a),f(N,t,a),o(t,F,a),o(t,v,a),o(t,L,a),o(t,A,a),o(t,K,a),o(t,R,a),o(t,tt,a),o(t,G,a),o(t,st,a),f(z,t,a),o(t,et,a),o(t,_,a),o(t,lt,a),f(V,t,a),o(t,nt,a),o(t,H,a),at=!0},p(t,[a]){const Jt={};a&2&&(Jt.$$scope={dirty:a,ctx:t}),g.$set(Jt);const ht={};a&2&&(ht.$$scope={dirty:a,ctx:t}),B.$set(ht)},i(t){at||(j(M.$$.fragment,t),j(g.$$.fragment,t),j(Q.$$.fragment,t),j(E.$$.fragment,t),j(B.$$.fragment,t),j(Z.$$.fragment,t),j(N.$$.fragment,t),j(z.$$.fragment,t),j(V.$$.fragment,t),at=!0)},o(t){w(M.$$.fragment,t),w(g.$$.fragment,t),w(Q.$$.fragment,t),w(E.$$.fragment,t),w(B.$$.fragment,t),w(Z.$$.fragment,t),w(N.$$.fragment,t),w(z.$$.fragment,t),w(V.$$.fragment,t),at=!1},d(t){t&&(n(r),n(e),n(i),n(y),n(k),n(J),n(h),n($),n(l),n(X),n(C),n(Y),n(x),n(O),n(P),n(F),n(v),n(L),n(A),n(K),n(R),n(tt),n(G),n(st),n(et),n(_),n(lt),n(nt),n(H)),n(s),q(M,t),q(g,t),q(Q,t),q(E,t),q(B,t),q(Z,t),q(N,t),q(z,t),q(V,t)}}}const Nt='{"title":"Table Question Answering","local":"table-question-answering","sections":[{"title":"Recommended models","local":"recommended-models","sections":[],"depth":3},{"title":"Using the API","local":"using-the-api","sections":[],"depth":3},{"title":"API specification","local":"api-specification","sections":[{"title":"Request","local":"request","sections":[],"depth":4},{"title":"Response","local":"response","sections":[],"depth":4}],"depth":3}],"depth":2}';function vt(b){return dt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Wt extends mt{constructor(s){super(),ft(this,s,vt,Zt,Tt,{})}}export{Wt as component};

Xet Storage Details

Size:
29 kB
·
Xet hash:
c396ce5daf399edd2de95dbfa1eb2805d766f40877f41dd0c88cdeb38108e01b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.