import requests def query(payload, model_id, api_token): headers = {"Authorization": f"Bearer {os.environ.get("HF_TOKEN", None)}"} API_URL = f"https://api-inference.huggingface.co/models/{model_id}" response = requests.post(API_URL, headers=headers, json=payload) print(response.text) # Print the response text here for debugging return response.json() model_id = "tiiuae/falcon-7B" # Model identifier payload = {"inputs": "what is generative ai? "} data = query(payload, model_id, api_token) #print(data) # Print the final result