govbridge-api / test_ingest.py
Acytel's picture
Configure production environment variables for Vercel deployment
a40c8e4
Raw
History Blame Contribute Delete
1.23 kB
import requests
import json
# Replace this with your actual Hugging Face Space URL
HF_API_URL = "https://harshrawat18-govbridge-api.hf.space"
# Replace this with the ADMIN_SECRET you just created in Hugging Face
ADMIN_SECRET = "govbridge-1008-1119wfgdfgwfwjhghjwgjhvbwvc"
# The real data we are sending to the AI
payload = {
"title": "PM-KISAN (Pradhan Mantri Kisan Samman Nidhi)",
"text": "Under the PM-KISAN scheme, all landholding farmers' families shall be provided the financial benefit of Rs. 6000 per annum per family payable in three equal installments of Rs. 2000 each, every four months. The scheme aims to supplement the financial needs of the farmers in procuring various inputs to ensure proper crop health and appropriate yields, commensurate with the anticipated farm income.",
"ministry": "Ministry of Agriculture and Farmers Welfare",
"doc_type": "scheme"
}
print("Sending data across the bridge to Hugging Face...")
response = requests.post(
f"{HF_API_URL}/api/admin/ingest?admin_key={ADMIN_SECRET}",
json=payload
)
if response.status_code == 200:
print("✅ SUCCESS!")
print(json.dumps(response.json(), indent=2))
else:
print("❌ FAILED!")
print(response.text)