Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload folder using huggingface_hub
Browse files- config.py +56 -1
- copy_chromadb.py +5 -0
- modules/scripture_helpers/pancha_sooktham_helper.py +19 -0
config.py
CHANGED
|
@@ -10,6 +10,7 @@ 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.vishnu_sahasranamam_helper import (
|
| 14 |
get_chapter_order_from_sahasranamam,
|
| 15 |
get_chapters_from_sahasranamam,
|
|
@@ -108,7 +109,7 @@ class SanatanConfig:
|
|
| 108 |
"unit": "verse",
|
| 109 |
"unit_field": "relative_verse_number",
|
| 110 |
"chapter_order": lambda: get_chapter_order_from_bhagavat_gita(),
|
| 111 |
-
"audio_storage"
|
| 112 |
"field_mapping": {
|
| 113 |
"text": "sanskrit",
|
| 114 |
"title": "verse_title",
|
|
@@ -785,6 +786,60 @@ class SanatanConfig:
|
|
| 785 |
"if the user asks for YouTube videos, DO NOT do a web search, instead do a search on this collection."
|
| 786 |
],
|
| 787 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 788 |
]
|
| 789 |
|
| 790 |
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 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,
|
|
|
|
| 109 |
"unit": "verse",
|
| 110 |
"unit_field": "relative_verse_number",
|
| 111 |
"chapter_order": lambda: get_chapter_order_from_bhagavat_gita(),
|
| 112 |
+
"audio_storage": "external",
|
| 113 |
"field_mapping": {
|
| 114 |
"text": "sanskrit",
|
| 115 |
"title": "verse_title",
|
|
|
|
| 786 |
"if the user asks for YouTube videos, DO NOT do a web search, instead do a search on this collection."
|
| 787 |
],
|
| 788 |
},
|
| 789 |
+
{
|
| 790 |
+
"name": "pancha_sooktham",
|
| 791 |
+
"title": "Pancha Sooktham",
|
| 792 |
+
"output_dir": "./output/pancha_sooktham",
|
| 793 |
+
"collection_name": "pancha_sooktham",
|
| 794 |
+
"collection_embedding_fn": "openai",
|
| 795 |
+
"unit": "verse",
|
| 796 |
+
"unit_field": "relative_verse_number",
|
| 797 |
+
"chapter_order": lambda: get_chapter_order_from_pancha_sooktham(),
|
| 798 |
+
"audio_storage": "external",
|
| 799 |
+
"field_mapping": {
|
| 800 |
+
"text": "sanskrit",
|
| 801 |
+
"unit_index": "relative_verse_number",
|
| 802 |
+
"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')}",
|
| 803 |
+
"chapter_name": "chapter_title",
|
| 804 |
+
"relative_path": lambda doc: f"{doc.get('chapter_title',"")}-{doc.get('relative_verse_number',"")}",
|
| 805 |
+
},
|
| 806 |
+
"metadata_fields": [
|
| 807 |
+
{
|
| 808 |
+
"name": "chapter_title",
|
| 809 |
+
"datatype": "str",
|
| 810 |
+
"label": "Chapter Name",
|
| 811 |
+
"description": "Name of the Chapter",
|
| 812 |
+
"show_as_filter": True,
|
| 813 |
+
"component": "dropdown",
|
| 814 |
+
"lov": lambda: get_pancha_sooktham_chapters(),
|
| 815 |
+
"is_unique": True,
|
| 816 |
+
},
|
| 817 |
+
{
|
| 818 |
+
"name": "sanskrit",
|
| 819 |
+
"label": "Lyrics in sanskrit",
|
| 820 |
+
"datatype": "str",
|
| 821 |
+
"description": "The original sloka in sanskrit.",
|
| 822 |
+
},
|
| 823 |
+
{
|
| 824 |
+
"name": "relative_verse_number",
|
| 825 |
+
"label": "Relative Verse Number",
|
| 826 |
+
"datatype": "int",
|
| 827 |
+
"description": "The relative verse number of the sloka inside the chapter.",
|
| 828 |
+
"show_as_filter": True,
|
| 829 |
+
"is_unique": True,
|
| 830 |
+
},
|
| 831 |
+
],
|
| 832 |
+
"pdf_path": "./data/pancha_sooktham.pdf",
|
| 833 |
+
"source": "https://stotranidhi.com/",
|
| 834 |
+
"language": "san+eng",
|
| 835 |
+
"example_labels": [
|
| 836 |
+
"Purusha Sooktham",
|
| 837 |
+
],
|
| 838 |
+
"examples": [
|
| 839 |
+
"Show some verses from purusha sooktham",
|
| 840 |
+
],
|
| 841 |
+
"llm_hints": [],
|
| 842 |
+
},
|
| 843 |
]
|
| 844 |
|
| 845 |
def get_scripture_by_collection(self, collection_name: str):
|
copy_chromadb.py
CHANGED
|
@@ -23,6 +23,11 @@ db_config = {
|
|
| 23 |
"source_collection_name": "bhagavat_gita",
|
| 24 |
"destination_collection_name": "bhagavat_gita_openai",
|
| 25 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
parser = argparse.ArgumentParser(description="My app with database parameter")
|
|
|
|
| 23 |
"source_collection_name": "bhagavat_gita",
|
| 24 |
"destination_collection_name": "bhagavat_gita_openai",
|
| 25 |
},
|
| 26 |
+
"pancha_sooktham": {
|
| 27 |
+
"source_db_path": "../sooktham_ai/chromadb_store",
|
| 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")
|
modules/scripture_helpers/pancha_sooktham_helper.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def get_chapter_order_from_pancha_sooktham():
|
| 5 |
+
return {
|
| 6 |
+
"Purusha Suktam": 1,
|
| 7 |
+
"Narayana Suktam": 2,
|
| 8 |
+
"Sri Suktam": 3,
|
| 9 |
+
"Bhu Suktam": 4,
|
| 10 |
+
"Neela Suktam": 5,
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def get_pancha_sooktham_chapters() -> list[str]:
|
| 15 |
+
"""
|
| 16 |
+
Get a list of chapter names from pancha sooktham
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
return sorted(get_chapter_order_from_pancha_sooktham().keys())
|