Download gercek_pilot/db_kur.py from SevdanurGenc/Text-to-SQL: direct link, hf CLI and curl.
- Browser
- Download file 949 Bytes
-
https://huggingface.co/SevdanurGenc/Text-to-SQL/resolve/main/gercek_pilot/db_kur.py
- Command line
-
hf download hf://SevdanurGenc/Text-to-SQL/gercek_pilot/db_kur.py
-
curl -L -o db_kur.py https://huggingface.co/SevdanurGenc/Text-to-SQL/resolve/main/gercek_pilot/db_kur.py
949 Bytes
| """Ayrılmış test belgeleri için belge başına veritabanı kurar. Yalnızca süre ve tablo SAYISI yazar (içerik yazmaz).""" | |
| import sys, time, warnings, json | |
| warnings.filterwarnings("ignore") | |
| sys.path.insert(0, str(__import__("pathlib").Path(__file__).resolve().parent.parent)) | |
| from pathlib import Path | |
| from t2s.pipeline import build_database | |
| P = Path(__file__).resolve().parent; B = P / "test_belgeler"; O = P / "db_test"; O.mkdir(exist_ok=True) | |
| log = {} | |
| for d in sorted(B.glob("*.pdf"), key=lambda p: p.stat().st_size): | |
| t0 = time.time() | |
| try: | |
| r = build_database(O / f"{d.stem}.db", docs=[d], mode="tr") | |
| log[d.name] = {"sn": round(time.time() - t0, 1), "tablo": len(r[0].written)} | |
| except Exception as e: | |
| log[d.name] = {"sn": round(time.time() - t0, 1), "hata": str(e)[:200]} | |
| print(d.name, log[d.name], flush=True) | |
| (O / "kurulum_gunlugu.json").write_text(json.dumps(log, ensure_ascii=False, indent=1)) | |