Spaces:
Sleeping
Sleeping
File size: 813 Bytes
ca042ba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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)
|