Upload examples/basic_usage.py with huggingface_hub
Browse files- examples/basic_usage.py +6 -6
examples/basic_usage.py
CHANGED
|
@@ -19,7 +19,7 @@ def example_1_default_model():
|
|
| 19 |
trust_remote_code=True
|
| 20 |
)
|
| 21 |
|
| 22 |
-
print(f"
|
| 23 |
print(f" Config: {model.config}")
|
| 24 |
print()
|
| 25 |
|
|
@@ -39,7 +39,7 @@ def example_2_variant_by_parameters():
|
|
| 39 |
trust_remote_code=True
|
| 40 |
)
|
| 41 |
|
| 42 |
-
print(f"
|
| 43 |
print(f" Data source: 7T-21T")
|
| 44 |
print(f" K neighbors: 1")
|
| 45 |
print(f" Metric: euclidean")
|
|
@@ -59,7 +59,7 @@ def example_3_variant_by_name():
|
|
| 59 |
trust_remote_code=True
|
| 60 |
)
|
| 61 |
|
| 62 |
-
print(f"
|
| 63 |
print(f" Config: {model.config}")
|
| 64 |
print()
|
| 65 |
|
|
@@ -90,7 +90,7 @@ def example_4_make_predictions():
|
|
| 90 |
# Get predictions
|
| 91 |
predictions = model(X_sample)
|
| 92 |
|
| 93 |
-
print(f"
|
| 94 |
print(f" First 3 predictions: {predictions[:3]}")
|
| 95 |
print()
|
| 96 |
|
|
@@ -140,11 +140,11 @@ if __name__ == "__main__":
|
|
| 140 |
example_5_compare_models()
|
| 141 |
|
| 142 |
print("=" * 60)
|
| 143 |
-
print("
|
| 144 |
print("=" * 60)
|
| 145 |
|
| 146 |
except Exception as e:
|
| 147 |
-
print(f"\n
|
| 148 |
print("\nNote: These examples require the model to be uploaded to")
|
| 149 |
print(" Hugging Face Hub at: pcdslab/dom-knn-models")
|
| 150 |
print("\nFor local testing, replace the repo ID with a local path.")
|
|
|
|
| 19 |
trust_remote_code=True
|
| 20 |
)
|
| 21 |
|
| 22 |
+
print(f"[OK] Model loaded successfully")
|
| 23 |
print(f" Config: {model.config}")
|
| 24 |
print()
|
| 25 |
|
|
|
|
| 39 |
trust_remote_code=True
|
| 40 |
)
|
| 41 |
|
| 42 |
+
print(f"[OK] Model loaded successfully")
|
| 43 |
print(f" Data source: 7T-21T")
|
| 44 |
print(f" K neighbors: 1")
|
| 45 |
print(f" Metric: euclidean")
|
|
|
|
| 59 |
trust_remote_code=True
|
| 60 |
)
|
| 61 |
|
| 62 |
+
print(f"[OK] Model loaded: knn_21T_k3_manhattan")
|
| 63 |
print(f" Config: {model.config}")
|
| 64 |
print()
|
| 65 |
|
|
|
|
| 90 |
# Get predictions
|
| 91 |
predictions = model(X_sample)
|
| 92 |
|
| 93 |
+
print(f"[OK] Predictions shape: {predictions.shape}")
|
| 94 |
print(f" First 3 predictions: {predictions[:3]}")
|
| 95 |
print()
|
| 96 |
|
|
|
|
| 140 |
example_5_compare_models()
|
| 141 |
|
| 142 |
print("=" * 60)
|
| 143 |
+
print("[OK] All examples completed successfully!")
|
| 144 |
print("=" * 60)
|
| 145 |
|
| 146 |
except Exception as e:
|
| 147 |
+
print(f"\n[ERROR] Error: {e}")
|
| 148 |
print("\nNote: These examples require the model to be uploaded to")
|
| 149 |
print(" Hugging Face Hub at: pcdslab/dom-knn-models")
|
| 150 |
print("\nFor local testing, replace the repo ID with a local path.")
|