lattifai 0.2.5__py3-none-any.whl → 0.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ lattifai/__init__.py,sha256=1fsfV7nE3GCTh9s4GWizv8vGa6bro4HC5vReeDxCSHI,2208
2
+ lattifai/base_client.py,sha256=NO3tBl42z8ARfiepiOBzaw7zX9hJe1zgB_gCgLJpuhc,3713
3
+ lattifai/client.py,sha256=WewbRnfI8b_rQ8V2JG3y2ojkiyEWylXI7No_4NpbzEI,13282
4
+ lattifai/errors.py,sha256=5i_acoly1g-TLAID8QnhzQshwOXfgLL55mHsdwzlNGA,10814
5
+ lattifai/utils.py,sha256=CzVwNc08u8lm7XavCMJskXHfni0xsZ-EgpcMkRywVm8,4736
6
+ lattifai/bin/__init__.py,sha256=QWbmVUbzqwPQNeOV_g-bOsz53w37v-tbZ3uFrSj-7Mg,90
7
+ lattifai/bin/agent.py,sha256=daXsg0PsW4HS53PYw-r6fSSDsoe9XHOIVEzz-djjKto,9935
8
+ lattifai/bin/align.py,sha256=Tpu2OWBXBYUqzBt1Qu6HmkVZ8Bpx6mc0O9KItDimoCc,8377
9
+ lattifai/bin/cli_base.py,sha256=i4KQDyUPJFKae_wjuQeB4N2Vhg9vZ6yc6L9YUJLC18I,507
10
+ lattifai/bin/subtitle.py,sha256=UZMPh71O2X1UwbfZ9VWlhzxkz78viz8KWwoVsDpewK0,6577
11
+ lattifai/io/__init__.py,sha256=mGnQkGm6BClRcogRK3J1nJJfPOk5z4o0sZI2nnyJVOU,1087
12
+ lattifai/io/gemini_reader.py,sha256=WDZA93MSrUAsa5j-ZDXLdPXzEIoREymEy-rMAED_6f4,15152
13
+ lattifai/io/gemini_writer.py,sha256=rlXO9zx6kQhqTi9K9izE69-8S-2GPOIiJHPwZyebpiM,6515
14
+ lattifai/io/parser.py,sha256=LQHgcEYXaSdhwUo9rP6P_31Z6RMv_BTP1YSKzXji4bk,2386
15
+ lattifai/io/reader.py,sha256=wm4O4ry2ZtBbGtO1FQTrTa1r2_83gUfZpzdh61qvuu0,3328
16
+ lattifai/io/supervision.py,sha256=iBDRiDJ0hddo__SoEZau2cdEIBFnXZNLgSWFjtJd-lM,871
17
+ lattifai/io/utils.py,sha256=4drRwcM1n7AYhdJcF51EZxMTy_Ut_1GKtdWpRhPuVmg,686
18
+ lattifai/io/writer.py,sha256=8n9ZBuXuVOCFwzr1hqrnXpZ-fARTsepebwjKgRuueWE,3872
19
+ lattifai/tokenizer/__init__.py,sha256=y-FyfO7tLga9b46pkCC6jdSBKOFZS-jFfHcqUieGEyU,120
20
+ lattifai/tokenizer/phonemizer.py,sha256=SfRi1KIMpmaao6OVmR1h_I_3QU-vrE6D5bh72Afg5XM,1759
21
+ lattifai/tokenizer/tokenizer.py,sha256=m6dDvvDmaVFtQd0aikMUViRZNzztXM0OyFs-vlToT9o,19191
22
+ lattifai/workers/__init__.py,sha256=s6YfkIq4FDIAzY9sPjRpXnJfszj2repqnMTqydRM5Zw,83
23
+ lattifai/workers/lattice1_alpha.py,sha256=1lCq0-bgWMXvYslAbCTFgHC0p6UWPto1y0wkTw9WrmQ,10177
24
+ lattifai-0.4.1.dist-info/licenses/LICENSE,sha256=LNuoH5jpXXNKgjQ3XLwztFq8D3O7kZI-LSg81o4ym2M,1065
25
+ lattifai-0.4.1.dist-info/METADATA,sha256=MLSUT7RUUOUd0lD_NA3GIR-AjBBkwjZV-HLiNK5k534,26719
26
+ lattifai-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ lattifai-0.4.1.dist-info/entry_points.txt,sha256=fCgo8-LKA_9C7_jmEGsZPJko0woXHtEh0iRbpO7PYzI,69
28
+ lattifai-0.4.1.dist-info/top_level.txt,sha256=-OVWZ68YYFcTN13ARkLasp2OUappe9wEVq-CKes7jM4,17
29
+ lattifai-0.4.1.dist-info/RECORD,,
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ lai = lattifai.bin:cli
3
+ lattifai = lattifai.bin:cli
@@ -1,334 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: lattifai
3
- Version: 0.2.5
4
- Summary: Lattifai Python SDK: Seamless Integration with Lattifai's Speech and Video AI Services
5
- Author-email: Lattifai Technologies <tech@lattifai.com>
6
- Maintainer-email: Lattice <tech@lattifai.com>
7
- License: MIT License
8
-
9
- Copyright (c) 2025 Lattifai.
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
28
- Project-URL: Homepage, https://github.com/lattifai/lattifai-python
29
- Project-URL: Documentation, https://github.com/lattifai/lattifai-python/README.md
30
- Project-URL: Bug Tracker, https://github.com/lattifai/lattifai-python/issues
31
- Project-URL: Discussions, https://github.com/lattifai/lattifai-python/discussions
32
- Project-URL: Changelog, https://github.com/lattifai/lattifai-python/CHANGELOG.md
33
- Keywords: lattifai,speech recognition,video analysis,ai,sdk,api client
34
- Classifier: Development Status :: 5 - Production/Stable
35
- Classifier: Intended Audience :: Developers
36
- Classifier: Intended Audience :: Science/Research
37
- Classifier: License :: OSI Approved :: Apache Software License
38
- Classifier: Programming Language :: Python :: 3.9
39
- Classifier: Programming Language :: Python :: 3.10
40
- Classifier: Programming Language :: Python :: 3.11
41
- Classifier: Programming Language :: Python :: 3.12
42
- Classifier: Programming Language :: Python :: 3.13
43
- Classifier: Operating System :: MacOS :: MacOS X
44
- Classifier: Operating System :: POSIX :: Linux
45
- Classifier: Operating System :: Microsoft :: Windows
46
- Classifier: Topic :: Multimedia :: Sound/Audio
47
- Classifier: Topic :: Multimedia :: Video
48
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
49
- Requires-Python: >=3.9
50
- Description-Content-Type: text/markdown
51
- License-File: LICENSE
52
- Requires-Dist: lattifai-core>=0.2.0
53
- Requires-Dist: httpx
54
- Requires-Dist: python-dotenv
55
- Requires-Dist: lhotse>=1.26.0
56
- Requires-Dist: colorful>=0.5.6
57
- Requires-Dist: pysubs2
58
- Requires-Dist: praatio
59
- Requires-Dist: tgt
60
- Requires-Dist: onnxruntime
61
- Requires-Dist: resampy
62
- Requires-Dist: g2p-phonemizer==0.1.1
63
- Requires-Dist: wtpsplit>=2.1.6
64
- Requires-Dist: av
65
- Provides-Extra: numpy
66
- Requires-Dist: numpy; extra == "numpy"
67
- Provides-Extra: test
68
- Requires-Dist: pytest; extra == "test"
69
- Requires-Dist: pytest-cov; extra == "test"
70
- Requires-Dist: ruff; extra == "test"
71
- Requires-Dist: numpy; extra == "test"
72
- Provides-Extra: all
73
- Requires-Dist: numpy; extra == "all"
74
- Requires-Dist: pytest; extra == "all"
75
- Requires-Dist: pytest-cov; extra == "all"
76
- Requires-Dist: ruff; extra == "all"
77
- Dynamic: license-file
78
-
79
- # LattifAI Python
80
-
81
- [![PyPI version](https://badge.fury.io/py/lattifai.svg)](https://badge.fury.io/py/lattifai)
82
-
83
- <p align="center">
84
- 🌐 <a href="https://lattifai.com"><b>Official Website</b></a> &nbsp&nbsp | &nbsp&nbsp 🖥️ <a href="https://github.com/lattifai/lattifai-python">GitHub</a> &nbsp&nbsp | &nbsp&nbsp 🤗 <a href="https://huggingface.co/Lattifai/Lattice-1-Alpha">Model</a> &nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://lattifai.com/blogs">Blog</a> &nbsp&nbsp | &nbsp&nbsp <a href="https://discord.gg/gTZqdaBJ"><img src="https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white" alt="Discord" style="vertical-align: middle;"></a>
85
- </p>
86
-
87
- Advanced forced alignment and subtitle generation powered by [Lattice-1-Alpha](https://huggingface.co/Lattifai/Lattice-1-Alpha) model.
88
-
89
- ## Installation
90
-
91
- ```bash
92
- pip install install-k2
93
- # The installation will automatically detect and use your already installed PyTorch version.
94
- install-k2 # Install k2
95
-
96
- pip install lattifai
97
- ```
98
-
99
- > **⚠️ Important**: You must run `install-k2` before using the lattifai library.
100
-
101
- ## Quick Start
102
-
103
- ### Command Line
104
-
105
- ```bash
106
- # Align audio with subtitle
107
- lattifai align audio.wav subtitle.srt output.srt
108
-
109
- # Convert subtitle format
110
- lattifai subtitle convert input.srt output.vtt
111
- ```
112
- #### lattifai align options
113
- ```
114
- > lattifai align --help
115
- Usage: lattifai align [OPTIONS] INPUT_AUDIO_PATH INPUT_SUBTITLE_PATH OUTPUT_SUBTITLE_PATH
116
-
117
- Command used to align audio with subtitles
118
-
119
- Options:
120
- -F, --input_format [srt|vtt|ass|txt|auto] Input Subtitle format.
121
- -D, --device [cpu|cuda|mps] Device to use for inference.
122
- --split_sentence Smart sentence splitting based on punctuation semantics.
123
- --help Show this message and exit.
124
- ```
125
-
126
- #### Understanding --split_sentence
127
-
128
- The `--split_sentence` option performs intelligent sentence re-splitting based on punctuation and semantic boundaries. This is especially useful when processing subtitles that combine multiple semantic units in a single segment, such as:
129
-
130
- - **Mixed content**: Non-speech elements (e.g., `[APPLAUSE]`, `[MUSIC]`) followed by actual dialogue
131
- - **Natural punctuation boundaries**: Colons, periods, and other punctuation marks that indicate semantic breaks
132
- - **Concatenated phrases**: Multiple distinct utterances joined together without proper separation
133
-
134
- **Example transformations**:
135
- ```
136
- Input: "[APPLAUSE] >> MIRA MURATI: Thank you all"
137
- Output: ["[APPLAUSE]", ">> MIRA MURATI: Thank you all"]
138
-
139
- Input: "[MUSIC] Welcome back. Today we discuss AI."
140
- Output: ["[MUSIC]", "Welcome back.", "Today we discuss AI."]
141
- ```
142
-
143
- This feature helps improve alignment accuracy by:
144
- 1. Respecting punctuation-based semantic boundaries
145
- 2. Separating distinct utterances for more precise timing
146
- 3. Maintaining semantic context for each independent phrase
147
-
148
- **Usage**:
149
- ```bash
150
- lattifai align --split_sentence audio.wav subtitle.srt output.srt
151
- ```
152
-
153
- ### Python API
154
-
155
- ```python
156
- from lattifai import LattifAI
157
-
158
- # Initialize client
159
- client = LattifAI(
160
- api_key: Optional[str] = None,
161
- model_name_or_path='Lattifai/Lattice-1-Alpha',
162
- device='cpu', # 'cpu', 'cuda', or 'mps'
163
- )
164
-
165
- # Perform alignment
166
- result = client.alignment(
167
- audio="audio.wav",
168
- subtitle="subtitle.srt",
169
- split_sentence=False,
170
- output_subtitle_path="output.srt"
171
- )
172
- ```
173
-
174
- ## Supported Formats
175
-
176
- **Audio**: WAV, MP3, FLAC, M4A, OGG
177
- **Subtitle**: SRT, VTT, ASS, TXT (plain text)
178
-
179
- ## API Reference
180
-
181
- ### LattifAI
182
-
183
- ```python
184
- LattifAI(
185
- api_key: Optional[str] = None,
186
- model_name_or_path: str = 'Lattifai/Lattice-1-Alpha',
187
- device: str = 'cpu' # 'cpu', 'cuda', or 'mps'
188
- )
189
- ```
190
-
191
- ### alignment()
192
-
193
- ```python
194
- client.alignment(
195
- audio: str, # Path to audio file
196
- subtitle: str, # Path to subtitle/text file
197
- format: Optional[str] = None, # 'srt', 'vtt', 'ass', 'txt' (auto-detect if None)
198
- split_sentence: bool = False, # Smart sentence splitting based on punctuation semantics
199
- output_subtitle_path: Optional[str] = None
200
- ) -> str
201
- ```
202
-
203
- **Parameters**:
204
- - `audio`: Path to the audio file to be aligned
205
- - `subtitle`: Path to the subtitle or text file
206
- - `format`: Subtitle format ('srt', 'vtt', 'ass', 'txt'). Auto-detected if None
207
- - `split_sentence`: Enable intelligent sentence re-splitting (default: False). Set to True when subtitles combine multiple semantic units (non-speech elements + dialogue, or multiple sentences) that would benefit from separate timing alignment
208
- - `output_subtitle_path`: Output path for aligned subtitle (optional)
209
-
210
- ## Examples
211
-
212
- ### Basic Text Alignment
213
-
214
- ```python
215
- client = LattifAI()
216
- client.alignment(
217
- audio="speech.wav",
218
- subtitle="transcript.txt",
219
- format="txt",
220
- split_sentence=False,
221
- output_subtitle_path="output.srt"
222
- )
223
- ```
224
-
225
- ### Batch Processing
226
-
227
- ```python
228
- from pathlib import Path
229
-
230
- client = LattifAI()
231
- audio_dir = Path("audio_files")
232
- subtitle_dir = Path("subtitles")
233
- output_dir = Path("aligned")
234
-
235
- for audio in audio_dir.glob("*.wav"):
236
- subtitle = subtitle_dir / f"{audio.stem}.srt"
237
- if subtitle.exists():
238
- client.alignment(
239
- audio=audio,
240
- subtitle=subtitle,
241
- output_subtitle_path=output_dir / f"{audio.stem}_aligned.srt"
242
- )
243
- ```
244
-
245
- ### GPU Acceleration
246
-
247
- ```python
248
- # NVIDIA GPU
249
- client = LattifAI(device='cuda')
250
-
251
- # Apple Silicon
252
- client = LattifAI(device='mps')
253
-
254
- # CLI
255
- lattifai align --device mps audio.wav subtitle.srt output.srt
256
- ```
257
-
258
- ## Configuration
259
-
260
- ### API Key Setup
261
-
262
- First, create your API key at [https://lattifai.com/dashboard/api-keys](https://lattifai.com/dashboard/api-keys)
263
-
264
- **Recommended: Using .env file**
265
-
266
- Create a `.env` file in your project root:
267
- ```bash
268
- LATTIFAI_API_KEY=your-api-key
269
- ```
270
-
271
- The library automatically loads the `.env` file (python-dotenv is included as a dependency).
272
-
273
- **Alternative: Environment variable**
274
- ```bash
275
- export LATTIFAI_API_KEY="your-api-key"
276
- ```
277
-
278
- ## Model Information
279
-
280
- **[Lattice-1-Alpha](https://huggingface.co/Lattifai/Lattice-1-Alpha)** features:
281
- - State-of-the-art alignment precision
282
- - **Language Support**: Currently supports English only. The upcoming **Lattice-1** release will support English, Chinese, and mixed English-Chinese content.
283
- - Handles noisy audio and imperfect transcripts
284
- - Optimized for CPU and GPU (CUDA/MPS)
285
-
286
- **Requirements**:
287
- - Python 3.9+
288
- - 4GB RAM recommended
289
- - ~2GB storage for model files
290
-
291
- ## Development
292
-
293
- ### Setup
294
-
295
- ```bash
296
- git clone https://github.com/lattifai/lattifai-python.git
297
- cd lattifai-python
298
- pip install -e ".[test]"
299
- ./scripts/install-hooks.sh # Optional: install pre-commit hooks
300
- ```
301
-
302
- ### Testing
303
-
304
- ```bash
305
- pytest # Run all tests
306
- pytest --cov=src # With coverage
307
- pytest tests/test_basic.py # Specific test
308
- ```
309
-
310
- ### Code Quality
311
-
312
- ```bash
313
- ruff check src/ tests/ # Lint
314
- ruff format src/ tests/ # Format
315
- isort src/ tests/ # Sort imports
316
- ```
317
-
318
- ## Contributing
319
-
320
- 1. Fork the repository
321
- 2. Create a feature branch
322
- 3. Make changes and add tests
323
- 4. Run `pytest` and `ruff check`
324
- 5. Submit a pull request
325
-
326
- ## License
327
-
328
- Apache License 2.0
329
-
330
- ## Support
331
-
332
- - **Issues**: [GitHub Issues](https://github.com/lattifai/lattifai-python/issues)
333
- - **Discussions**: [GitHub Discussions](https://github.com/lattifai/lattifai-python/discussions)
334
- - **Discord**: [Join our community](https://discord.gg/gTZqdaBJ)
@@ -1,23 +0,0 @@
1
- lattifai/__init__.py,sha256=moXL8kuk_Xmis2xK5JKpTx8hvcWb__JI75OI73Yf20I,2069
2
- lattifai/base_client.py,sha256=q0l-hiAQKTWQiRXiwaHsCpSpieK_PrWRk7kmDtEfTig,3346
3
- lattifai/client.py,sha256=XJAaNI02swLdiHG6lRAgh3SHso-FI_tJAPFENttzO10,8341
4
- lattifai/errors.py,sha256=BAN57q_PE6HTQJW4mM6X0k-CZOzemsIQBGo5xmJDSsE,8735
5
- lattifai/bin/__init__.py,sha256=7YhmtEM8kbxJtz2-KIskvpLKBZAvkMSceVx8z4fkgQ4,61
6
- lattifai/bin/align.py,sha256=nQs901SDYmxyH2AXBtjgZGzrpwLaxANQRYP49Bd1AWo,1669
7
- lattifai/bin/cli_base.py,sha256=y535WXDRX8StloFn9icpfw7nQt0JxuWBIuPMnRxAYy8,392
8
- lattifai/bin/subtitle.py,sha256=bUWImAHpvyY59Vskqb5loQiD5ytQOxR8lTQRiQ4LyNA,647
9
- lattifai/io/__init__.py,sha256=vHWRN7MvAch-GUeFqqO-gM57SM-4YOpGUjIxFJdjfPA,671
10
- lattifai/io/reader.py,sha256=mtgxT5c_BiHbqqJvPE3nf7TIe_OcWgGu1zr6iXasfrk,2591
11
- lattifai/io/supervision.py,sha256=5UfSsgBhXoDU3-6drDtoD7y8HIiA4xRKZnbOKgeejwM,354
12
- lattifai/io/writer.py,sha256=1eAEFLlL8kricxRDPFBtVmeC4IiFyFnjbWXvw0VU-q4,2036
13
- lattifai/tokenizer/__init__.py,sha256=aqv44PDtq6g3oFFKW_l4HSR5ywT5W8eP1dHHywIvBfs,72
14
- lattifai/tokenizer/phonemizer.py,sha256=SfRi1KIMpmaao6OVmR1h_I_3QU-vrE6D5bh72Afg5XM,1759
15
- lattifai/tokenizer/tokenizer.py,sha256=0UxlEIkOq9u6e8RMtlYOTVRjUxExo5r8LXpkzedlJNE,11606
16
- lattifai/workers/__init__.py,sha256=s6YfkIq4FDIAzY9sPjRpXnJfszj2repqnMTqydRM5Zw,83
17
- lattifai/workers/lattice1_alpha.py,sha256=1lCq0-bgWMXvYslAbCTFgHC0p6UWPto1y0wkTw9WrmQ,10177
18
- lattifai-0.2.5.dist-info/licenses/LICENSE,sha256=LNuoH5jpXXNKgjQ3XLwztFq8D3O7kZI-LSg81o4ym2M,1065
19
- lattifai-0.2.5.dist-info/METADATA,sha256=-EEq4g932BbO1YlMKWc-rz4tpy-rr5cHb0GSGdKdfSI,10989
20
- lattifai-0.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- lattifai-0.2.5.dist-info/entry_points.txt,sha256=CwTI2NbJvF9msIHboAfTA99cmDr_HOWoODjS8R64JOw,131
22
- lattifai-0.2.5.dist-info/top_level.txt,sha256=-OVWZ68YYFcTN13ARkLasp2OUappe9wEVq-CKes7jM4,17
23
- lattifai-0.2.5.dist-info/RECORD,,
@@ -1,4 +0,0 @@
1
- [console_scripts]
2
- install-k2 = scripts.install_k2:install_k2
3
- lattifai = lattifai.bin:cli
4
- lattifai-align = lattifai.bin.align:align