|
Download README.md from SparkShift-Media/Sparky: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/SparkShift-Media/Sparky/resolve/main/README.md
- Command line
-
hf download hf://SparkShift-Media/Sparky/README.md
-
curl -L -o README.md https://huggingface.co/SparkShift-Media/Sparky/resolve/main/README.md
1.12 kB
| license: openrail | |
| from huggingface_hub.inference_api import InferenceApi | |
| # Mask-fill example | |
| inference = InferenceApi("bert-base-uncased") | |
| inference(inputs="The goal of life is [MASK].") | |
| # Question Answering example | |
| inference = InferenceApi("deepset/roberta-base-squad2") | |
| inputs = { | |
| "question": "What's my name?", | |
| "context": "My name is Clara and I live in Berkeley.", | |
| } | |
| inference(inputs) | |
| # Zero-shot example | |
| inference = InferenceApi("typeform/distilbert-base-uncased-mnli") | |
| inputs = "Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!" | |
| params = {"candidate_labels": ["refund", "legal", "faq"]} | |
| inference(inputs, params) | |
| # Overriding configured task | |
| inference = InferenceApi("bert-base-uncased", task="feature-extraction") | |
| # Text-to-image | |
| inference = InferenceApi("stabilityai/stable-diffusion-2-1") | |
| inference("cat") | |
| # Return as raw response to parse the output yourself | |
| inference = InferenceApi("mio/amadeus") | |
| response = inference("hello world", raw_response=True) | |
| response.headers | |
| response.content # raw bytes from server |