| import requests | |
| API_URL = "https://<use your own Inference Endpoint here>.endpoints.huggingface.cloud" | |
| headers = { | |
| "Accept" : "application/json", | |
| "Authorization": "Bearer hf_XXXXX", # <- use your own Hugging Face token with Inference Endpoints access | |
| "Content-Type": "application/json" | |
| } | |
| def query(payload): | |
| response = requests.post(API_URL, headers=headers, json=payload) | |
| return response.json() | |
| output = query({ | |
| "inputs": "underwater footage, beautiful clownfishes swimming around coral", | |
| "parameters": {} | |
| }) |