Spaces:
Sleeping
Sleeping
File size: 1,484 Bytes
842ca78 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import os
import requests
import json
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("HF_TOKEN")
headers = {"Authorization": f"Bearer {api_key}"}
candidates = [
"HuggingFaceM4/idefics2-8b",
"HuggingFaceM4/idefics2-8b-chatty",
"llava-hf/llava-1.5-7b-hf",
"llava-hf/llava-v1.6-mistral-7b-hf",
"microsoft/Phi-3-vision-128k-instruct",
"NousResearch/Nous-Hermes-2-Vision-Alpha",
"OpenGVLab/InternVL-Chat-V1-5",
"Qwen/Qwen2.5-VL-7B-Instruct",
"google/paligemma-3b-mix-224"
]
print("Scanning for working Serverless Vision Models...\n")
for model in candidates:
url = f"https://router.huggingface.co/models/{model}"
print(f"Testing: {model}")
try:
# Simple probe payload
response = requests.post(url, headers=headers, json={"inputs": "Hello"})
if response.status_code == 200:
print(f"β
WORKS! {model} (Status: 200)")
print(f"Response: {response.text[:100]}...")
elif response.status_code == 400:
# 400 might mean it Exists but input format is wrong (which is good!)
print(f"β οΈ EXISTS but 400 (Bad Request): {model}")
print(f"Response: {response.text[:100]}...")
elif response.status_code == 404:
print(f"β 404 Not Found: {model}")
else:
print(f"β Error {response.status_code}: {model}")
except Exception as e:
print(f"β Exception: {e}")
print("-" * 30)
|