Update README.md
Browse files
README.md
CHANGED
|
@@ -122,12 +122,19 @@ pip install onnxruntime-gpu onnx pillow numpy
|
|
| 122 |
|
| 123 |
### Inference / Инференс
|
| 124 |
|
| 125 |
-
|
| 126 |
import onnxruntime as ort
|
| 127 |
import onnx
|
| 128 |
import numpy as np
|
| 129 |
from PIL import Image
|
| 130 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
class AuthorID:
|
| 133 |
"""
|
|
@@ -194,8 +201,8 @@ class AuthorID:
|
|
| 194 |
|
| 195 |
# === Example Usage ===
|
| 196 |
if __name__ == "__main__":
|
| 197 |
-
# Initialize (once)
|
| 198 |
-
model = AuthorID(
|
| 199 |
|
| 200 |
# Predict
|
| 201 |
results = model.predict("your_image.jpg", top_k=5)
|
|
|
|
| 122 |
|
| 123 |
### Inference / Инференс
|
| 124 |
|
| 125 |
+
``python
|
| 126 |
import onnxruntime as ort
|
| 127 |
import onnx
|
| 128 |
import numpy as np
|
| 129 |
from PIL import Image
|
| 130 |
import json
|
| 131 |
+
from huggingface_hub import hf_hub_download
|
| 132 |
+
|
| 133 |
+
# Download model from HuggingFace (cached automatically)
|
| 134 |
+
MODEL_PATH = hf_hub_download(
|
| 135 |
+
repo_id="AugustLabs/Author_ID",
|
| 136 |
+
filename="author_id_500.onnx"
|
| 137 |
+
)
|
| 138 |
|
| 139 |
class AuthorID:
|
| 140 |
"""
|
|
|
|
| 201 |
|
| 202 |
# === Example Usage ===
|
| 203 |
if __name__ == "__main__":
|
| 204 |
+
# Initialize (once) — model downloads automatically
|
| 205 |
+
model = AuthorID(MODEL_PATH)
|
| 206 |
|
| 207 |
# Predict
|
| 208 |
results = model.predict("your_image.jpg", top_k=5)
|