YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Cham Disease Classifier
์ด ๋ชจ๋ธ์ ์ง๋ณ์ ๋ถ๋ฅํ๋ ONNX ๋ชจ๋ธ์ ๋๋ค.
๋ชจ๋ธ ์ ๋ณด
- ๋ชจ๋ธ ํ์: ONNX
- ์ ๋ ฅ: [์ ๋ ฅ ํ์ ์ค๋ช ]
- ์ถ๋ ฅ: [์ถ๋ ฅ ํ์ ์ค๋ช ]
์ฌ์ฉ ๋ฐฉ๋ฒ
import requests import base64 import json
API_URL = "https://api-inference.huggingface.co/models/YooGyu/cham" HEADERS = {"Authorization": "Bearer YOUR_API_TOKEN"}
def encode_image(image_path): """์ด๋ฏธ์ง๋ฅผ Base64๋ก ๋ณํ""" with open(image_path, "rb") as image_file: return base64.b64encode(image_file.read()).decode("utf-8")
def query(image_path): """API ์์ฒญ ๋ฐ ์๋ต ์ฒ๋ฆฌ""" encoded_image = encode_image(image_path) payload = json.dumps({"inputs": encoded_image})
response = requests.post(API_URL, headers=HEADERS, data=payload)
return response.json()
์์ ์ฌ์ฉ๋ฒ
image_path = "testimage/cham.jpg" output = query(image_path)
print(output)
๋ผ์ด์ผ์ค
[๋ผ์ด์ผ์ค ์ ๋ณด]
- Downloads last month
- 4