Download index.py from DRAI/README: direct link, hf CLI and curl.
- Browser
- Download file 652 Bytes
-
https://huggingface.co/spaces/DRAI/README/resolve/main/index.py
- Command line
-
hf download hf://spaces/DRAI/README/index.py
-
curl -L -o index.py https://huggingface.co/spaces/DRAI/README/resolve/main/index.py
652 Bytes
| import requests | |
| API_URL = "https://api-inference.huggingface.co/models/google/tapas-base-finetuned-wtq" | |
| headers = {"Authorization": "Bearer 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"} | |
| def query(payload): | |
| response = requests.post(API_URL, headers=headers, json=payload) | |
| return response.json() | |
| output = query({ | |
| "inputs": { | |
| "query": "How many stars does the transformers repository have?", | |
| "table": { | |
| "Repository": ["Transformers", "Datasets", "Tokenizers"], | |
| "Stars": ["36542", "4512", "3934"], | |
| "Contributors": ["651", "77", "34"], | |
| "Programming language": [ | |
| "Python", | |
| "Python", | |
| "Rust, Python and NodeJS" | |
| ] | |
| } | |
| }, | |
| }) |