whisperpipe 0.1.0__tar.gz

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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Erfan Ramezani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,229 @@
1
+ Metadata-Version: 2.4
2
+ Name: whisperpipe
3
+ Version: 0.1.0
4
+ Summary: Real-time speech-to-text streaming with OpenAI Whisper
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: whisper,openai,speech-to-text,stt,asr,automatic speech recognition,real-time,realtime,audio,microphone,transcription,streaming,live transcription
8
+ Author: Erfan Ramezani
9
+ Author-email: erfanramezany245@gmail.com
10
+ Requires-Python: >=3.9,<3.13
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: Microsoft :: Windows
22
+ Classifier: Operating System :: MacOS :: MacOS X
23
+ Classifier: Environment :: Console
24
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
25
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Capture/Recording
26
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
27
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
28
+ Requires-Dist: openai-whisper (>=20240930)
29
+ Requires-Dist: pyaudio (>=0.2.14)
30
+ Requires-Dist: pynput (>=1.7.7)
31
+ Requires-Dist: sounddevice (>=0.5.2)
32
+ Project-URL: Bug Tracker, https://github.com/Erfan-ram/whisperpipe/issues
33
+ Project-URL: Changelog, https://github.com/Erfan-ram/whisperpipe/releases
34
+ Project-URL: Documentation, https://github.com/Erfan-ram/whisperpipe/blob/main/README.md
35
+ Project-URL: Homepage, https://github.com/Erfan-ram/whisperpipe
36
+ Project-URL: Repository, https://github.com/Erfan-ram/whisperpipe
37
+ Project-URL: Source, https://github.com/Erfan-ram/whisperpipe
38
+ Description-Content-Type: text/markdown
39
+
40
+ # whisperpipe
41
+
42
+ Real-time speech-to-text streaming with OpenAI Whisper
43
+
44
+ ## Description
45
+
46
+ whisperpipe is a powerful, easy-to-use Python package for real-time, offline audio transcription using OpenAI's Whisper model. It runs locally, making it a free and private solution for continuous speech-to-text applications. It provides seamless integration with callback functions for LLM processing and supports pause/resume functionality for interactive applications.
47
+
48
+ ## Why whisperpipe?
49
+
50
+ In a world where most ASR (Automatic Speech Recognition) services are cloud-based, whisperpipe offers a refreshing alternative by harnessing the power of OpenAI's Whisper model to run directly on your local machine. This approach provides several key advantages:
51
+
52
+ - **Complete Privacy**: Since all transcription is done locally, your voice data never leaves your computer. This is crucial for applications that handle sensitive or private conversations.
53
+ - **Zero Cost**: Say goodbye to recurring subscription fees and per-minute charges. whisperpipe is free to use, making it an economical choice for both hobbyists and commercial projects.
54
+ - **No Internet Required**: Whether you're on a plane, in a remote location, or simply have an unstable internet connection, whisperpipe works flawlessly offline.
55
+ - **Real-time Performance**: Designed for continuous, real-time transcription, whisperpipe is ideal for live applications such as voice-controlled assistants, dictation software, and more.
56
+ - **Unleash the Power of Whisper**: By running the Whisper model locally, you have full control over the transcription process, from model selection to performance tuning.
57
+
58
+ whisperpipe empowers you to build powerful, private, and cost-effective voice applications with ease.
59
+
60
+ ## Features
61
+
62
+ - **Real-time audio transcription** using OpenAI Whisper
63
+ - **Callback system** for custom processing (LLM integration, etc.)
64
+ - **Pause/Resume functionality** for interactive applications
65
+ - **Multiple language support**
66
+ - **Configurable processing parameters**
67
+ - **Thread-safe operation**
68
+ - **Easy installation and usage**
69
+
70
+ ## Installation
71
+
72
+ ### From PyPI
73
+
74
+ ```bash
75
+ pip install whisperpipe
76
+ ```
77
+
78
+ ### From GitHub
79
+
80
+ ```bash
81
+ pip install git+https://github.com/Erfan-ram/whisperpipe.git
82
+ ```
83
+
84
+ ## Quick Start
85
+
86
+ ```python
87
+ from whisperpipe import pipeStream
88
+
89
+ # Basic usage
90
+ transcriber = pipeStream(
91
+ model_name="base",
92
+ language="en",
93
+ finalization_delay=10.0,
94
+ processing_interval=1.0
95
+ )
96
+
97
+ # Start streaming
98
+ transcriber.start_streaming()
99
+ ```
100
+
101
+ ## Usage Examples
102
+
103
+ ### Basic Transcription
104
+
105
+ ```python
106
+ from whisperpipe import pipeStream
107
+
108
+ # Create transcriber instance
109
+ transcriber = pipeStream(
110
+ model_name="base",
111
+ language="en",
112
+ finalization_delay=10.0,
113
+ processing_interval=1.0
114
+ )
115
+
116
+ # Start transcription
117
+ transcriber.start_streaming()
118
+
119
+ # The transcribed text will be printed to console
120
+ # Press Ctrl+C to stop
121
+ ```
122
+
123
+ ### With Custom Callback (LLM Integration)
124
+
125
+ ```python
126
+ from whisperpipe import pipeStream
127
+
128
+ def llm_processor(text):
129
+ """Custom function to process transcribed text"""
130
+ print(f"Processing: {text}")
131
+ # Your LLM integration here
132
+ # e.g., send to OpenAI, Claude, local model, etc.
133
+ response = your_llm_api.chat(text)
134
+ print(f"Response: {response}")
135
+ return response
136
+
137
+ # Create transcriber with callback
138
+ transcriber = pipeStream(
139
+ model_name="base",
140
+ language="en",
141
+ finalization_delay=10.0,
142
+ processing_interval=1.0
143
+ )
144
+
145
+ # Register callback
146
+ transcriber.set_def_callback(llm_processor)
147
+
148
+ # Start streaming with LLM integration
149
+ transcriber.start_streaming()
150
+ ```
151
+
152
+ ### Interactive Mode with Pause/Resume
153
+
154
+ ```python
155
+ from whisperpipe import pipeStream
156
+ import time
157
+
158
+ def interactive_processor(text):
159
+ """Process text and pause for response"""
160
+ # Pause transcriber while processing
161
+ transcriber.pause_streaming()
162
+
163
+ print(f"User said: {text}")
164
+
165
+ # Process with your system
166
+ response = process_with_llm(text)
167
+
168
+ # Speak or display response
169
+ print(f"Assistant: {response}")
170
+
171
+ # Resume for next input
172
+ transcriber.resume_streaming()
173
+
174
+ transcriber = pipeStream()
175
+ transcriber.set_def_callback(interactive_processor)
176
+ transcriber.start_streaming()
177
+ ```
178
+
179
+ ## API Reference
180
+
181
+ ### Constructor Parameters
182
+
183
+ - `model_name` (str): Whisper model name ("tiny", "base", "small", "medium", "large"). Default: "base"
184
+ - `language` (str): Language code for transcription ("en", "es", "fr", etc.). Default: "en"
185
+ - `finalization_delay` (float): Wait time in seconds before finalizing transcription. Default: 10.0
186
+ - `processing_interval` (float): Interval in seconds between processing cycles. Default: 1.0
187
+ - `buffer_duration_seconds` (float): Time window in seconds to hold audio for processing. Default: 5.0
188
+ - `debug_mode` (bool): Enable debug mode for detailed logging. Default: True
189
+
190
+ ### Methods
191
+
192
+ #### Core Methods
193
+ - `start_streaming()`: Start audio capture and transcription
194
+ - `stop_streaming()`: Stop audio capture and transcription
195
+
196
+ #### Callback System
197
+ - `set_def_callback(callback_function)`: Register a callback function for processing transcribed text
198
+ - `set_def_callback(None)`: Clear the callback (use default behavior)
199
+
200
+ #### Pause/Resume Control
201
+ - `pause_streaming()`: Pause audio processing temporarily
202
+ - `resume_streaming()`: Resume audio processing
203
+ - `is_paused()`: Check if transcriber is paused
204
+ - `is_running()`: Check if transcriber is running
205
+
206
+ ## Requirements
207
+
208
+ - Python 3.8+
209
+ - PyAudio
210
+ - OpenAI Whisper
211
+ - PyTorch
212
+ - NumPy
213
+ - pynput
214
+
215
+ ## License
216
+
217
+ MIT License
218
+
219
+ ## Author
220
+
221
+ Erfan Ramezani - erfanramezany245@gmail.com
222
+
223
+ ## Contributing
224
+
225
+ Contributions are welcome! Please feel free to submit a Pull Request.
226
+
227
+ ## Support
228
+
229
+ For issues and questions, please use the [GitHub Issues](https://github.com/Erfan-ram/whisperpipe/issues) page.
@@ -0,0 +1,190 @@
1
+ # whisperpipe
2
+
3
+ Real-time speech-to-text streaming with OpenAI Whisper
4
+
5
+ ## Description
6
+
7
+ whisperpipe is a powerful, easy-to-use Python package for real-time, offline audio transcription using OpenAI's Whisper model. It runs locally, making it a free and private solution for continuous speech-to-text applications. It provides seamless integration with callback functions for LLM processing and supports pause/resume functionality for interactive applications.
8
+
9
+ ## Why whisperpipe?
10
+
11
+ In a world where most ASR (Automatic Speech Recognition) services are cloud-based, whisperpipe offers a refreshing alternative by harnessing the power of OpenAI's Whisper model to run directly on your local machine. This approach provides several key advantages:
12
+
13
+ - **Complete Privacy**: Since all transcription is done locally, your voice data never leaves your computer. This is crucial for applications that handle sensitive or private conversations.
14
+ - **Zero Cost**: Say goodbye to recurring subscription fees and per-minute charges. whisperpipe is free to use, making it an economical choice for both hobbyists and commercial projects.
15
+ - **No Internet Required**: Whether you're on a plane, in a remote location, or simply have an unstable internet connection, whisperpipe works flawlessly offline.
16
+ - **Real-time Performance**: Designed for continuous, real-time transcription, whisperpipe is ideal for live applications such as voice-controlled assistants, dictation software, and more.
17
+ - **Unleash the Power of Whisper**: By running the Whisper model locally, you have full control over the transcription process, from model selection to performance tuning.
18
+
19
+ whisperpipe empowers you to build powerful, private, and cost-effective voice applications with ease.
20
+
21
+ ## Features
22
+
23
+ - **Real-time audio transcription** using OpenAI Whisper
24
+ - **Callback system** for custom processing (LLM integration, etc.)
25
+ - **Pause/Resume functionality** for interactive applications
26
+ - **Multiple language support**
27
+ - **Configurable processing parameters**
28
+ - **Thread-safe operation**
29
+ - **Easy installation and usage**
30
+
31
+ ## Installation
32
+
33
+ ### From PyPI
34
+
35
+ ```bash
36
+ pip install whisperpipe
37
+ ```
38
+
39
+ ### From GitHub
40
+
41
+ ```bash
42
+ pip install git+https://github.com/Erfan-ram/whisperpipe.git
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ```python
48
+ from whisperpipe import pipeStream
49
+
50
+ # Basic usage
51
+ transcriber = pipeStream(
52
+ model_name="base",
53
+ language="en",
54
+ finalization_delay=10.0,
55
+ processing_interval=1.0
56
+ )
57
+
58
+ # Start streaming
59
+ transcriber.start_streaming()
60
+ ```
61
+
62
+ ## Usage Examples
63
+
64
+ ### Basic Transcription
65
+
66
+ ```python
67
+ from whisperpipe import pipeStream
68
+
69
+ # Create transcriber instance
70
+ transcriber = pipeStream(
71
+ model_name="base",
72
+ language="en",
73
+ finalization_delay=10.0,
74
+ processing_interval=1.0
75
+ )
76
+
77
+ # Start transcription
78
+ transcriber.start_streaming()
79
+
80
+ # The transcribed text will be printed to console
81
+ # Press Ctrl+C to stop
82
+ ```
83
+
84
+ ### With Custom Callback (LLM Integration)
85
+
86
+ ```python
87
+ from whisperpipe import pipeStream
88
+
89
+ def llm_processor(text):
90
+ """Custom function to process transcribed text"""
91
+ print(f"Processing: {text}")
92
+ # Your LLM integration here
93
+ # e.g., send to OpenAI, Claude, local model, etc.
94
+ response = your_llm_api.chat(text)
95
+ print(f"Response: {response}")
96
+ return response
97
+
98
+ # Create transcriber with callback
99
+ transcriber = pipeStream(
100
+ model_name="base",
101
+ language="en",
102
+ finalization_delay=10.0,
103
+ processing_interval=1.0
104
+ )
105
+
106
+ # Register callback
107
+ transcriber.set_def_callback(llm_processor)
108
+
109
+ # Start streaming with LLM integration
110
+ transcriber.start_streaming()
111
+ ```
112
+
113
+ ### Interactive Mode with Pause/Resume
114
+
115
+ ```python
116
+ from whisperpipe import pipeStream
117
+ import time
118
+
119
+ def interactive_processor(text):
120
+ """Process text and pause for response"""
121
+ # Pause transcriber while processing
122
+ transcriber.pause_streaming()
123
+
124
+ print(f"User said: {text}")
125
+
126
+ # Process with your system
127
+ response = process_with_llm(text)
128
+
129
+ # Speak or display response
130
+ print(f"Assistant: {response}")
131
+
132
+ # Resume for next input
133
+ transcriber.resume_streaming()
134
+
135
+ transcriber = pipeStream()
136
+ transcriber.set_def_callback(interactive_processor)
137
+ transcriber.start_streaming()
138
+ ```
139
+
140
+ ## API Reference
141
+
142
+ ### Constructor Parameters
143
+
144
+ - `model_name` (str): Whisper model name ("tiny", "base", "small", "medium", "large"). Default: "base"
145
+ - `language` (str): Language code for transcription ("en", "es", "fr", etc.). Default: "en"
146
+ - `finalization_delay` (float): Wait time in seconds before finalizing transcription. Default: 10.0
147
+ - `processing_interval` (float): Interval in seconds between processing cycles. Default: 1.0
148
+ - `buffer_duration_seconds` (float): Time window in seconds to hold audio for processing. Default: 5.0
149
+ - `debug_mode` (bool): Enable debug mode for detailed logging. Default: True
150
+
151
+ ### Methods
152
+
153
+ #### Core Methods
154
+ - `start_streaming()`: Start audio capture and transcription
155
+ - `stop_streaming()`: Stop audio capture and transcription
156
+
157
+ #### Callback System
158
+ - `set_def_callback(callback_function)`: Register a callback function for processing transcribed text
159
+ - `set_def_callback(None)`: Clear the callback (use default behavior)
160
+
161
+ #### Pause/Resume Control
162
+ - `pause_streaming()`: Pause audio processing temporarily
163
+ - `resume_streaming()`: Resume audio processing
164
+ - `is_paused()`: Check if transcriber is paused
165
+ - `is_running()`: Check if transcriber is running
166
+
167
+ ## Requirements
168
+
169
+ - Python 3.8+
170
+ - PyAudio
171
+ - OpenAI Whisper
172
+ - PyTorch
173
+ - NumPy
174
+ - pynput
175
+
176
+ ## License
177
+
178
+ MIT License
179
+
180
+ ## Author
181
+
182
+ Erfan Ramezani - erfanramezany245@gmail.com
183
+
184
+ ## Contributing
185
+
186
+ Contributions are welcome! Please feel free to submit a Pull Request.
187
+
188
+ ## Support
189
+
190
+ For issues and questions, please use the [GitHub Issues](https://github.com/Erfan-ram/whisperpipe/issues) page.
@@ -0,0 +1,67 @@
1
+ [project]
2
+ name = "whisperpipe"
3
+ version = "0.1.0"
4
+ description = "Real-time speech-to-text streaming with OpenAI Whisper"
5
+ authors = [
6
+ {name = "Erfan Ramezani", email = "erfanramezany245@gmail.com"}
7
+ ]
8
+ license = {text = "MIT"}
9
+ readme = "README.md"
10
+ keywords = [
11
+ "whisper", "openai", "speech-to-text", "stt", "asr",
12
+ "automatic speech recognition", "real-time", "realtime",
13
+ "audio", "microphone", "transcription", "streaming", "live transcription"
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: End Users/Desktop",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Operating System :: POSIX :: Linux",
26
+ "Operating System :: Microsoft :: Windows",
27
+ "Operating System :: MacOS :: MacOS X",
28
+ "Environment :: Console",
29
+ "Topic :: Multimedia :: Sound/Audio :: Speech",
30
+ "Topic :: Multimedia :: Sound/Audio :: Capture/Recording",
31
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
32
+ "Topic :: Software Development :: Libraries :: Python Modules"
33
+ ]
34
+ requires-python = ">=3.9,<3.13"
35
+ dependencies = [
36
+ "openai-whisper>=20240930",
37
+ "pyaudio>=0.2.14",
38
+ "pynput>=1.7.7",
39
+ "sounddevice>=0.5.2"
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/Erfan-ram/whisperpipe"
44
+ Repository = "https://github.com/Erfan-ram/whisperpipe"
45
+ Documentation = "https://github.com/Erfan-ram/whisperpipe/blob/main/README.md"
46
+ "Bug Tracker" = "https://github.com/Erfan-ram/whisperpipe/issues"
47
+ "Source" = "https://github.com/Erfan-ram/whisperpipe"
48
+ Changelog = "https://github.com/Erfan-ram/whisperpipe/releases"
49
+
50
+ [tool.poetry.group.dev.dependencies]
51
+ pytest = "^7.0"
52
+ black = "^23.0"
53
+ flake8 = "^6.0"
54
+
55
+ [build-system]
56
+ requires = ["poetry-core"]
57
+ build-backend = "poetry.core.masonry.api"
58
+
59
+ [tool.pytest.ini_options]
60
+ testpaths = ["tests"]
61
+ python_files = ["test_*.py", "*_test.py"]
62
+ python_functions = ["test_*"]
63
+ addopts = "-v --tb=short"
64
+ filterwarnings = [
65
+ "ignore::DeprecationWarning",
66
+ "ignore::PendingDeprecationWarning"
67
+ ]
@@ -0,0 +1,14 @@
1
+ """
2
+ whisperpipe - Real-time speech-to-text streaming with OpenAI Whisper
3
+
4
+ A powerful, easy-to-use package for real-time audio transcription using OpenAI's Whisper model.
5
+ Features include callback support for LLM integration and pause/resume functionality.
6
+ """
7
+
8
+ from .core import pipeStream
9
+
10
+ __version__ = "1.0.0"
11
+ __author__ = "Erfan Ramezani"
12
+ __email__ = "erfanramezany245@gmail.com"
13
+
14
+ __all__ = ["pipeStream"]