Spaces:
				
			
			
	
			
			
					
		Running
		
			on 
			
			CPU Upgrade
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
			on 
			
			CPU Upgrade
	Upload folder using huggingface_hub
Browse files- config.py +63 -3
 - copy_chromadb.py +5 -0
 - modules/scripture_helpers/shanthi_panchakam_helper.py +19 -0
 
    	
        config.py
    CHANGED
    
    | 
         @@ -10,8 +10,15 @@ from modules.scripture_helpers.kamba_ramayanam_helper import ( 
     | 
|
| 10 | 
         
             
                get_list_of_padalams,
         
     | 
| 11 | 
         
             
                get_list_of_padalams_in_tamil,
         
     | 
| 12 | 
         
             
            )
         
     | 
| 13 | 
         
            -
            from modules.scripture_helpers.pancha_sooktham_helper import  
     | 
| 14 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 15 | 
         
             
            from modules.scripture_helpers.vishnu_sahasranamam_helper import (
         
     | 
| 16 | 
         
             
                get_chapter_order_from_sahasranamam,
         
     | 
| 17 | 
         
             
                get_chapters_from_sahasranamam,
         
     | 
| 
         @@ -892,7 +899,60 @@ class SanatanConfig: 
     | 
|
| 892 | 
         
             
                            "Show some verses from Seeksha Valli",
         
     | 
| 893 | 
         
             
                        ],
         
     | 
| 894 | 
         
             
                        "llm_hints": [],
         
     | 
| 895 | 
         
            -
                    }, 
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 896 | 
         
             
                ]
         
     | 
| 897 | 
         | 
| 898 | 
         
             
                def get_scripture_by_collection(self, collection_name: str):
         
     | 
| 
         | 
|
| 10 | 
         
             
                get_list_of_padalams,
         
     | 
| 11 | 
         
             
                get_list_of_padalams_in_tamil,
         
     | 
| 12 | 
         
             
            )
         
     | 
| 13 | 
         
            +
            from modules.scripture_helpers.pancha_sooktham_helper import (
         
     | 
| 14 | 
         
            +
                get_chapter_order_from_pancha_sooktham,
         
     | 
| 15 | 
         
            +
                get_pancha_sooktham_chapters,
         
     | 
| 16 | 
         
            +
            )
         
     | 
| 17 | 
         
            +
            from modules.scripture_helpers.shanthi_panchakam_helper import get_chapter_order_from_shanthi_panchakam, get_shanthi_panchakam_chapters
         
     | 
| 18 | 
         
            +
            from modules.scripture_helpers.taitriya_upanishad_helper import (
         
     | 
| 19 | 
         
            +
                get_chapter_order_from_taitriya_upanishad,
         
     | 
| 20 | 
         
            +
                get_taitriya_upanishad_chapters,
         
     | 
| 21 | 
         
            +
            )
         
     | 
| 22 | 
         
             
            from modules.scripture_helpers.vishnu_sahasranamam_helper import (
         
     | 
| 23 | 
         
             
                get_chapter_order_from_sahasranamam,
         
     | 
| 24 | 
         
             
                get_chapters_from_sahasranamam,
         
     | 
| 
         | 
|
| 899 | 
         
             
                            "Show some verses from Seeksha Valli",
         
     | 
| 900 | 
         
             
                        ],
         
     | 
| 901 | 
         
             
                        "llm_hints": [],
         
     | 
| 902 | 
         
            +
                    },
         
     | 
| 903 | 
         
            +
                    {
         
     | 
| 904 | 
         
            +
                        "name": "shanthi_panchakam",
         
     | 
| 905 | 
         
            +
                        "title": "Shanthi Panchakam",
         
     | 
| 906 | 
         
            +
                        "output_dir": "./output/shanthi_panchakam",
         
     | 
| 907 | 
         
            +
                        "collection_name": "shanthi_panchakam",
         
     | 
| 908 | 
         
            +
                        "collection_embedding_fn": "openai",
         
     | 
| 909 | 
         
            +
                        "unit": "verse",
         
     | 
| 910 | 
         
            +
                        "unit_field": "relative_verse_number",
         
     | 
| 911 | 
         
            +
                        "chapter_order": lambda: get_chapter_order_from_shanthi_panchakam(),
         
     | 
| 912 | 
         
            +
                        "field_mapping": {
         
     | 
| 913 | 
         
            +
                            "text": "sanskrit",
         
     | 
| 914 | 
         
            +
                            "unit_index": "relative_verse_number",
         
     | 
| 915 | 
         
            +
                            "transliteration": lambda doc: f"English: \n{doc.get('english')}\n\nதமிழ்: \n{doc.get('tamil')}\n\nతెలుగు: \n{doc.get('telugu')}\n\nಕನ್ನಡ: \n{doc.get('kannada')}",
         
     | 
| 916 | 
         
            +
                            "chapter_name": "chapter_title",
         
     | 
| 917 | 
         
            +
                            "relative_path": lambda doc: f"{doc.get('chapter_title',"")}-{doc.get('relative_verse_number',"")}",
         
     | 
| 918 | 
         
            +
                        },
         
     | 
| 919 | 
         
            +
                        "metadata_fields": [
         
     | 
| 920 | 
         
            +
                            {
         
     | 
| 921 | 
         
            +
                                "name": "chapter_title",
         
     | 
| 922 | 
         
            +
                                "datatype": "str",
         
     | 
| 923 | 
         
            +
                                "label": "Chapter Name",
         
     | 
| 924 | 
         
            +
                                "description": "Name of the Chapter",
         
     | 
| 925 | 
         
            +
                                "show_as_filter": True,
         
     | 
| 926 | 
         
            +
                                "component": "dropdown",
         
     | 
| 927 | 
         
            +
                                "lov": lambda: get_shanthi_panchakam_chapters(),
         
     | 
| 928 | 
         
            +
                                "is_unique": True,
         
     | 
| 929 | 
         
            +
                            },
         
     | 
| 930 | 
         
            +
                            {
         
     | 
| 931 | 
         
            +
                                "name": "sanskrit",
         
     | 
| 932 | 
         
            +
                                "label": "Lyrics in sanskrit",
         
     | 
| 933 | 
         
            +
                                "datatype": "str",
         
     | 
| 934 | 
         
            +
                                "description": "The original sloka in sanskrit.",
         
     | 
| 935 | 
         
            +
                            },
         
     | 
| 936 | 
         
            +
                            {
         
     | 
| 937 | 
         
            +
                                "name": "relative_verse_number",
         
     | 
| 938 | 
         
            +
                                "label": "Relative Verse Number",
         
     | 
| 939 | 
         
            +
                                "datatype": "int",
         
     | 
| 940 | 
         
            +
                                "description": "The relative verse number of the sloka inside the chapter.",
         
     | 
| 941 | 
         
            +
                                "show_as_filter": True,
         
     | 
| 942 | 
         
            +
                                "is_unique": True,
         
     | 
| 943 | 
         
            +
                            },
         
     | 
| 944 | 
         
            +
                        ],
         
     | 
| 945 | 
         
            +
                        "pdf_path": "./data/shanthi_panchakam.pdf",
         
     | 
| 946 | 
         
            +
                        "source": "https://vignanam.org/english/shanti-panchakam.html",
         
     | 
| 947 | 
         
            +
                        "language": "san+eng",
         
     | 
| 948 | 
         
            +
                        "example_labels": [
         
     | 
| 949 | 
         
            +
                            "Shanthi Panchakam",
         
     | 
| 950 | 
         
            +
                        ],
         
     | 
| 951 | 
         
            +
                        "examples": [
         
     | 
| 952 | 
         
            +
                            "Show some verses from Shanthi Panchakam",
         
     | 
| 953 | 
         
            +
                        ],
         
     | 
| 954 | 
         
            +
                        "llm_hints": [],
         
     | 
| 955 | 
         
            +
                    },
         
     | 
| 956 | 
         
             
                ]
         
     | 
| 957 | 
         | 
| 958 | 
         
             
                def get_scripture_by_collection(self, collection_name: str):
         
     | 
    	
        copy_chromadb.py
    CHANGED
    
    | 
         @@ -33,6 +33,11 @@ db_config = { 
     | 
|
| 33 | 
         
             
                    "source_collection_name": "taitriya_upanishad",
         
     | 
| 34 | 
         
             
                    "destination_collection_name": "taitriya_upanishad",
         
     | 
| 35 | 
         
             
                },
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 36 | 
         
             
            }
         
     | 
| 37 | 
         | 
| 38 | 
         
             
            parser = argparse.ArgumentParser(description="My app with database parameter")
         
     | 
| 
         | 
|
| 33 | 
         
             
                    "source_collection_name": "taitriya_upanishad",
         
     | 
| 34 | 
         
             
                    "destination_collection_name": "taitriya_upanishad",
         
     | 
| 35 | 
         
             
                },
         
     | 
| 36 | 
         
            +
                "shanthi_panchakam": {
         
     | 
| 37 | 
         
            +
                    "source_db_path": "../shanthi_panchakam_ai/chromadb_store",
         
     | 
| 38 | 
         
            +
                    "source_collection_name": "shanthi_panchakam",
         
     | 
| 39 | 
         
            +
                    "destination_collection_name": "shanthi_panchakam",
         
     | 
| 40 | 
         
            +
                },
         
     | 
| 41 | 
         
             
            }
         
     | 
| 42 | 
         | 
| 43 | 
         
             
            parser = argparse.ArgumentParser(description="My app with database parameter")
         
     | 
    	
        modules/scripture_helpers/shanthi_panchakam_helper.py
    ADDED
    
    | 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            import json
         
     | 
| 2 | 
         
            +
             
     | 
| 3 | 
         
            +
             
     | 
| 4 | 
         
            +
            def get_chapter_order_from_shanthi_panchakam():
         
     | 
| 5 | 
         
            +
                return {
         
     | 
| 6 | 
         
            +
                    "Chapter 1": 1,
         
     | 
| 7 | 
         
            +
                    "Chapter 2": 2,
         
     | 
| 8 | 
         
            +
                    "Chapter 3": 3,
         
     | 
| 9 | 
         
            +
                    "Chapter 4": 4,
         
     | 
| 10 | 
         
            +
                    "Chapter 5": 5,
         
     | 
| 11 | 
         
            +
                }
         
     | 
| 12 | 
         
            +
             
     | 
| 13 | 
         
            +
             
     | 
| 14 | 
         
            +
            def get_shanthi_panchakam_chapters() -> list[str]:
         
     | 
| 15 | 
         
            +
                """
         
     | 
| 16 | 
         
            +
                Get a list of chapter names from shanthi panchakam
         
     | 
| 17 | 
         
            +
                """
         
     | 
| 18 | 
         
            +
             
     | 
| 19 | 
         
            +
                return sorted(get_chapter_order_from_shanthi_panchakam().keys())
         
     |