https://cloudimageclass-mixederapi.mixeder.com/
async function classifyImage(apiKey, imageUrl) {
const apiUrl = 'https://cloudimageclass-mixederapi.mixeder.com/';
const queryParams = new URLSearchParams({ key: apiKey, imageurl: imageUrl });
try {
const response = await fetch(`${apiUrl}?${queryParams.toString()}`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
if (!response.ok) {
throw new Error(`API error: ${response.statusText}`);
}
const data = await response.json();
console.log('Image classification result:', data.response);
return data.response;
} catch (error) {
console.error('Error during image classification:', error.message);
throw error;
}
}
// 使用例
classifyImage('your-api-key', 'https://example.com/image.jpg')
.then((result) => console.log('Classification Result:', result))
.catch((err) => console.error('Classification failed:', err));
import requests
def classify_image(api_key, image_url):
api_url = 'https://cloudimageclass-mixederapi.mixeder.com/'
params = {
"key": api_key,
"imageurl": image_url,
}
try:
response = requests.get(api_url, params=params)
response.raise_for_status()
data = response.json()
print("Image classification result:", data["response"])
return data["response"]
except requests.exceptions.RequestException as e:
print("Error during image classification:", e)
raise
# 使用例
classify_image("your-api-key", "https://example.com/image.jpg")
curl -X GET 'https://cloudimageclass-mixederapi.mixeder.com/?key=your-api-key&imageurl=https://example.com/image.jpg' \
-H "Content-Type: application/json"