Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- config.py +55 -0
- copy_chromadb.py +5 -0
- modules/scripture_helpers/taitriya_upanishad_helper.py +17 -0
config.py
CHANGED
|
@@ -11,6 +11,7 @@ from modules.scripture_helpers.kamba_ramayanam_helper import (
|
|
| 11 |
get_list_of_padalams_in_tamil,
|
| 12 |
)
|
| 13 |
from modules.scripture_helpers.pancha_sooktham_helper import get_chapter_order_from_pancha_sooktham, get_pancha_sooktham_chapters
|
|
|
|
| 14 |
from modules.scripture_helpers.vishnu_sahasranamam_helper import (
|
| 15 |
get_chapter_order_from_sahasranamam,
|
| 16 |
get_chapters_from_sahasranamam,
|
|
@@ -840,6 +841,60 @@ class SanatanConfig:
|
|
| 840 |
],
|
| 841 |
"llm_hints": [],
|
| 842 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 843 |
]
|
| 844 |
|
| 845 |
def get_scripture_by_collection(self, collection_name: str):
|
|
|
|
| 11 |
get_list_of_padalams_in_tamil,
|
| 12 |
)
|
| 13 |
from modules.scripture_helpers.pancha_sooktham_helper import get_chapter_order_from_pancha_sooktham, get_pancha_sooktham_chapters
|
| 14 |
+
from modules.scripture_helpers.taitriya_upanishad_helper import get_chapter_order_from_taitriya_upanishad, get_taitriya_upanishad_chapters
|
| 15 |
from modules.scripture_helpers.vishnu_sahasranamam_helper import (
|
| 16 |
get_chapter_order_from_sahasranamam,
|
| 17 |
get_chapters_from_sahasranamam,
|
|
|
|
| 841 |
],
|
| 842 |
"llm_hints": [],
|
| 843 |
},
|
| 844 |
+
{
|
| 845 |
+
"name": "taitriya_upanishad",
|
| 846 |
+
"title": "Taitriya Upanishad",
|
| 847 |
+
"output_dir": "./output/taitriya_upanishad",
|
| 848 |
+
"collection_name": "taitriya_upanishad",
|
| 849 |
+
"collection_embedding_fn": "openai",
|
| 850 |
+
"unit": "verse",
|
| 851 |
+
"unit_field": "relative_verse_number",
|
| 852 |
+
"chapter_order": lambda: get_chapter_order_from_taitriya_upanishad(),
|
| 853 |
+
"audio_storage": "external",
|
| 854 |
+
"field_mapping": {
|
| 855 |
+
"text": "sanskrit",
|
| 856 |
+
"unit_index": "relative_verse_number",
|
| 857 |
+
"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')}",
|
| 858 |
+
"chapter_name": "chapter_title",
|
| 859 |
+
"relative_path": lambda doc: f"{doc.get('chapter_title',"")}-{doc.get('relative_verse_number',"")}",
|
| 860 |
+
},
|
| 861 |
+
"metadata_fields": [
|
| 862 |
+
{
|
| 863 |
+
"name": "chapter_title",
|
| 864 |
+
"datatype": "str",
|
| 865 |
+
"label": "Chapter Name",
|
| 866 |
+
"description": "Name of the Chapter",
|
| 867 |
+
"show_as_filter": True,
|
| 868 |
+
"component": "dropdown",
|
| 869 |
+
"lov": lambda: get_taitriya_upanishad_chapters(),
|
| 870 |
+
"is_unique": True,
|
| 871 |
+
},
|
| 872 |
+
{
|
| 873 |
+
"name": "sanskrit",
|
| 874 |
+
"label": "Lyrics in sanskrit",
|
| 875 |
+
"datatype": "str",
|
| 876 |
+
"description": "The original sloka in sanskrit.",
|
| 877 |
+
},
|
| 878 |
+
{
|
| 879 |
+
"name": "relative_verse_number",
|
| 880 |
+
"label": "Relative Verse Number",
|
| 881 |
+
"datatype": "int",
|
| 882 |
+
"description": "The relative verse number of the sloka inside the chapter.",
|
| 883 |
+
"show_as_filter": True,
|
| 884 |
+
"is_unique": True,
|
| 885 |
+
},
|
| 886 |
+
],
|
| 887 |
+
"pdf_path": "./data/taitriya_upanishad.pdf",
|
| 888 |
+
"source": "https://stotranidhi.com/",
|
| 889 |
+
"language": "san+eng",
|
| 890 |
+
"example_labels": [
|
| 891 |
+
"Seeksha Valli",
|
| 892 |
+
],
|
| 893 |
+
"examples": [
|
| 894 |
+
"Show some verses from Seeksha Valli",
|
| 895 |
+
],
|
| 896 |
+
"llm_hints": [],
|
| 897 |
+
},
|
| 898 |
]
|
| 899 |
|
| 900 |
def get_scripture_by_collection(self, collection_name: str):
|
copy_chromadb.py
CHANGED
|
@@ -28,6 +28,11 @@ db_config = {
|
|
| 28 |
"source_collection_name": "pancha_sooktham",
|
| 29 |
"destination_collection_name": "pancha_sooktham",
|
| 30 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
parser = argparse.ArgumentParser(description="My app with database parameter")
|
|
|
|
| 28 |
"source_collection_name": "pancha_sooktham",
|
| 29 |
"destination_collection_name": "pancha_sooktham",
|
| 30 |
},
|
| 31 |
+
"taitriya_upanishad": {
|
| 32 |
+
"source_db_path": "../taitriya_upanishad_ai/chromadb_store",
|
| 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")
|
modules/scripture_helpers/taitriya_upanishad_helper.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def get_chapter_order_from_taitriya_upanishad():
|
| 5 |
+
return {
|
| 6 |
+
"Seekashaavalli": 1,
|
| 7 |
+
"Aanandavalli": 2,
|
| 8 |
+
"Bruguvalli": 3,
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def get_taitriya_upanishad_chapters() -> list[str]:
|
| 13 |
+
"""
|
| 14 |
+
Get a list of chapter names from taitriya upanishad
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
return sorted(get_chapter_order_from_taitriya_upanishad().keys())
|