Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Generate embeddings for hospital-specific documents | |
| """ | |
| from customization_pipeline import build_customization_embeddings | |
| def main(): | |
| print("π Starting to build hospital-specific embeddings...") | |
| print("π Configuration:") | |
| print(" - Chunk size: 256 tokens") | |
| print(" - Chunk overlap: 25 tokens (10%)") | |
| print(" - Method: SentenceSplitter") | |
| print(" - Enhanced tag embeddings: β ") | |
| print(" - Chunk embeddings: β ") | |
| print("") | |
| try: | |
| success = build_customization_embeddings() | |
| if success: | |
| print("\nβ Successfully built embeddings!") | |
| print("π Generated files in processing folder:") | |
| print(" - embeddings/document_index.json") | |
| print(" - embeddings/tag_embeddings.json") | |
| print(" - embeddings/document_tag_mapping.json") | |
| print(" - embeddings/chunk_embeddings.json") | |
| print(" - indices/annoy_metadata.json") | |
| print(" - indices/*.ann files") | |
| else: | |
| print("\nβ Failed to build embeddings") | |
| except KeyboardInterrupt: | |
| print("\nβ οΈ Process interrupted by user") | |
| except Exception as e: | |
| print(f"β Error occurred: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| if __name__ == "__main__": | |
| main() |