API 文档
快速开始
欢迎使用我们的API。本文档将指导您如何快速开始使用我们的服务。
基础URL: https://dev.obscura.work/
认证
所有API请求都需要使用API密钥进行认证。您可以在用户中心的API密钥页面获取的API密钥。
示例代码
Python
import requests
base_url = 'https://dev.obscura.work/v1'
headers = {
'accept': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY', # 替换为您的 API 密钥
'Content-Type': 'application/json'
}
# 替换为您的文件路径
file_path = 'PATH_TO_YOUR_FILE'
# 替换为模型名称
upload_url = f'{base_url}/MODEL_NAME'
with open(file_path, 'rb') as file:
data = {'image': file}
response = requests.post(upload_url, headers=headers, files=data)
response.raise_for_status()
result = response.json()
task_id = result.get('task_id')
annotated_url = f'{base_url}/annotated/{task_id}'
response = requests.get(annotated_url, headers=headers)
response.raise_for_status()
with open(f'annotated_{task_id}.jpg', 'wb') as f:
f.write(response.content)
print(f"标注图片已保存为 annotated_{task_id}.jpg")
请输入图片URL或上传图片
加载中...
检测结果
| Name | Role | Actions |
|---|