Spaces:
Running
Running
Create utils/__init__.py
Browse files- utils/__init__.py +62 -0
utils/__init__.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
LifeAdmin AI - Utilities Module
|
| 3 |
+
|
| 4 |
+
Helper functions for:
|
| 5 |
+
- llm_utils: LLM provider management and fallback chain
|
| 6 |
+
- audio_utils: Text-to-speech and speech-to-text processing
|
| 7 |
+
- pdf_utils: PDF manipulation and text extraction
|
| 8 |
+
- text_utils: Text parsing and extraction
|
| 9 |
+
- file_utils: File operations and management
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from .llm_utils import get_llm_response, setup_llm_fallback
|
| 13 |
+
from .audio_utils import text_to_speech, speech_to_text, process_audio_input
|
| 14 |
+
from .pdf_utils import (
|
| 15 |
+
extract_text_from_pdf,
|
| 16 |
+
get_pdf_metadata,
|
| 17 |
+
split_pdf_pages
|
| 18 |
+
)
|
| 19 |
+
from .text_utils import (
|
| 20 |
+
extract_dates,
|
| 21 |
+
extract_amounts,
|
| 22 |
+
extract_emails,
|
| 23 |
+
extract_phone_numbers,
|
| 24 |
+
clean_text
|
| 25 |
+
)
|
| 26 |
+
from .file_utils import (
|
| 27 |
+
get_file_info,
|
| 28 |
+
ensure_directory,
|
| 29 |
+
copy_file,
|
| 30 |
+
move_file,
|
| 31 |
+
list_files
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
__all__ = [
|
| 35 |
+
# LLM
|
| 36 |
+
'get_llm_response',
|
| 37 |
+
'setup_llm_fallback',
|
| 38 |
+
|
| 39 |
+
# Audio
|
| 40 |
+
'text_to_speech',
|
| 41 |
+
'speech_to_text',
|
| 42 |
+
'process_audio_input',
|
| 43 |
+
|
| 44 |
+
# PDF
|
| 45 |
+
'extract_text_from_pdf',
|
| 46 |
+
'get_pdf_metadata',
|
| 47 |
+
'split_pdf_pages',
|
| 48 |
+
|
| 49 |
+
# Text
|
| 50 |
+
'extract_dates',
|
| 51 |
+
'extract_amounts',
|
| 52 |
+
'extract_emails',
|
| 53 |
+
'extract_phone_numbers',
|
| 54 |
+
'clean_text',
|
| 55 |
+
|
| 56 |
+
# Files
|
| 57 |
+
'get_file_info',
|
| 58 |
+
'ensure_directory',
|
| 59 |
+
'copy_file',
|
| 60 |
+
'move_file',
|
| 61 |
+
'list_files',
|
| 62 |
+
]
|