Views
No views yet
1import requests
2
3# Model URL (Hugging Face API URL)
4model_url = "https://api-inference.huggingface.co/models/sultanDilawar/react-redux-model"
5
6# Authorization header with your Hugging Face API token
7headers = {"Authorization": `Bearer ${HF_TOKEN}`}
8
9# Input data for question answering
10data = {"inputs": "What is Redux?"}
11
12# Sending the request to Hugging Face API
13response = requests.post(model_url, headers=headers, json=data)
14
15# Output the result
16if response.status_code == 200:
17 print(response.json()) # This will give the answer
18else:
19 print(f"Error {response.status_code}: {response.text}")