feat: service inventory, ERP reports, sqlite-vec integration, visualize tool
- Add SERVICE_INVENTORY_V1.0.0.md (25 source-verified tools, 3.7GB) - Add ERP_SELECTION_REPORT.md (Odoo CE vs ERPNext comparison) - Add SFTPGO_ODOO_REPLACEMENT.md (SFTPGo migration plan) - Add SERVICE_GO_GITEA_BUILD.md (Go compiler + Gitea build report) - Add release visualize command (face trace heatmap + identity filter) - Add sqlite-vec integration (160MB SQLite with vec0 vector tables) - Add export_identities.py, export_sqlite.py, render_face_heatmap.py - Add Go, Gitea, Rust/Cargo, Swift, yt-dlp, SQLite, sqlite-vec to service CLI - Fix package to include identities and identity_bindings in data.sql - Update release list to show all deployed video stats - Add V1.0.0 YAML frontmatter to all docs (DOCS_STANDARD compliant)
This commit is contained in:
48
scripts/insert_chunks.py
Normal file
48
scripts/insert_chunks.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/opt/homebrew/bin/python3.11
|
||||
"""Insert sentence chunks from transcribe.py output into dev.chunk table."""
|
||||
import json, sys
|
||||
import psycopg2
|
||||
|
||||
DB = "dbname=momentry user=accusys"
|
||||
UUID = sys.argv[1] if len(sys.argv) > 1 else "23b1c872379d4ec06479e5ed39eef4c5"
|
||||
ASR_PATH = f"/Users/accusys/momentry/output_dev/{UUID}.asr.json"
|
||||
FPS = 23.976023976023978
|
||||
|
||||
with open(ASR_PATH) as f:
|
||||
asr = json.load(f)
|
||||
|
||||
segments = asr.get("segments", [])
|
||||
print(f"Inserting {len(segments)} sentence chunks for {UUID}...")
|
||||
|
||||
conn = psycopg2.connect(DB)
|
||||
cur = conn.cursor()
|
||||
|
||||
inserted = 0
|
||||
for seg in segments:
|
||||
chunk_id = seg["chunk_id"]
|
||||
start_time = seg["start_time"]
|
||||
end_time = seg["end_time"]
|
||||
start_frame = int(start_time * FPS)
|
||||
end_frame = int(end_time * FPS)
|
||||
text = seg.get("text", "")
|
||||
speaker_change = seg.get("speaker_change", False)
|
||||
|
||||
content = json.dumps({
|
||||
"source": "transcribe",
|
||||
"speaker_change": speaker_change,
|
||||
"pass1_index": seg.get("pass1_index", 0),
|
||||
})
|
||||
|
||||
cur.execute("""
|
||||
INSERT INTO dev.chunk (file_uuid, chunk_id, chunk_type, start_time, end_time,
|
||||
start_frame, end_frame, fps, text_content, content, created_at)
|
||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s::jsonb, NOW())
|
||||
ON CONFLICT (file_uuid, chunk_id) DO NOTHING
|
||||
""", (UUID, chunk_id, "sentence", start_time, end_time,
|
||||
start_frame, end_frame, FPS, text, content))
|
||||
inserted += 1
|
||||
|
||||
conn.commit()
|
||||
cur.close()
|
||||
conn.close()
|
||||
print(f"Done: {inserted} chunks inserted")
|
||||
Reference in New Issue
Block a user