Spaces:
Sleeping
Sleeping
Download scripts/reindex.py from mgbam/MCP_Research: direct link, hf CLI and curl.
- Browser
- Download file 647 Bytes
-
https://huggingface.co/spaces/mgbam/MCP_Research/resolve/30db50a13c8faa2cf2d5fccaebf5f806d4839700/scripts/reindex.py
- Command line
-
hf download hf://spaces/mgbam/MCP_Research@30db50a13c8faa2cf2d5fccaebf5f806d4839700/scripts/reindex.py
-
curl -L -o reindex.py https://huggingface.co/spaces/mgbam/MCP_Research/resolve/30db50a13c8faa2cf2d5fccaebf5f806d4839700/scripts/reindex.py
647 Bytes
| # File: scripts/reindex.py | |
| import yaml | |
| from orchestrator.client import MCPClient | |
| from orchestrator.provenance import init_db, Paper | |
| if __name__ == '__main__': | |
| cfg = yaml.safe_load(open('config.yaml')) | |
| chroma = MCPClient(cfg['mcp_servers']['chroma']) | |
| Session = init_db(cfg.get('db_url', 'sqlite:///embeddings.db')) | |
| session = Session() | |
| papers = session.query(Paper).all() | |
| print(f'Reindexing {len(papers)} papers...') | |
| for paper in papers: | |
| text = (paper.title or '') + ' ' + (paper.abstract or '') | |
| chroma.call('chroma.insert', {'id': paper.id, 'text': text, 'metadata': {}}) | |
| print('Reindex complete!') |