media-gen-api / test_combined_api.py
osnarayana's picture
Added auto_test_endpoints.py to verify all endpoints in swagger
ca042ba
raw
history blame contribute delete
813 Bytes
import requests
BASE_URL = "https://osnarayana-media-gen-api.hf.space/api/v1/metrics"
TOKEN = "my_secure_token_123" # must match app/auth/auth.py
headers = {
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json"
}
# 1️⃣ BLEU
bleu_payload = {"reference": "hello world", "candidate": "hello"}
r1 = requests.post(f"{BASE_URL}/evaluate/bleu", headers=headers, params={"reference": "hello world", "candidate": "hello"})
print("BLEU Response:", r1.status_code, r1.text)
# 2️⃣ CLIPScore
clip_payload = {"reference": "a photo of a cat", "candidate": "an image of a cute cat"}
r2 = requests.post(f"{BASE_URL}/evaluate/clipscore", headers=headers, params={"reference": "a photo of a cat", "candidate": "an image of a cute cat"})
print("CLIPScore Response:", r2.status_code, r2.text)