Spaces:
Paused
Paused
Download scripts/inspect_v2.py from Abdalkaderdev/ORA: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/spaces/Abdalkaderdev/ORA/resolve/main/scripts/inspect_v2.py
- Command line
-
hf download hf://spaces/Abdalkaderdev/ORA/scripts/inspect_v2.py
-
curl -L -o inspect_v2.py https://huggingface.co/spaces/Abdalkaderdev/ORA/resolve/main/scripts/inspect_v2.py
1.05 kB
| from datasets import load_dataset | |
| import lancedb | |
| import pandas as pd | |
| import shutil | |
| def inspect_and_verify(): | |
| print("--- 1. Inspecting 'odunola/bible-reference-sentence-pair' ---") | |
| try: | |
| ds = load_dataset("odunola/bible-reference-sentence-pair", split="train", streaming=True) | |
| print("Success! First 3 examples:") | |
| count = 0 | |
| for ex in ds: | |
| print(ex) | |
| count += 1 | |
| if count >= 3: | |
| break | |
| except Exception as e: | |
| print(f"Failed to load dataset: {e}") | |
| print("\n--- 2. Verifying LanceDB ---") | |
| try: | |
| db = lancedb.connect("data/lancedb_test") | |
| df = pd.DataFrame({"vector": [[1.1, 1.2], [2.1, 2.2]], "item": ["foo", "bar"]}) | |
| tbl = db.create_table("test_table", data=df, mode="overwrite") | |
| print(f"Created table. Count: {len(tbl)}") | |
| shutil.rmtree("data/lancedb_test") | |
| print("LanceDB verified.") | |
| except Exception as e: | |
| print(f"LanceDB failure: {e}") | |
| if __name__ == "__main__": | |
| inspect_and_verify() | |