test-model / request.py
mingyk's picture
updated 1
21b4ef9
raw
history blame contribute delete
462 Bytes
import requests
url = "https://api-inference.huggingface.co/models/your-username/linear-regression-model"
headers = {"Authorization": "Bearer YOUR_HUGGINGFACE_API_TOKEN"}
# Define the columns and open the CSV file in binary mode
columns = ["feature1", "feature2", "feature3"]
files = {
"inputs": ("data.csv", open("path/to/your/data.csv", "rb")),
"columns": columns
}
response = requests.post(url, headers=headers, files=files)
print(response.json())