TranscribeNPy 0.1.2__tar.gz → 1.0.5__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.
- {transcribenpy-0.1.2/src/TranscribeNPy.egg-info → transcribenpy-1.0.5}/PKG-INFO +17 -2
- transcribenpy-1.0.5/README.md +38 -0
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/pyproject.toml +1 -1
- {transcribenpy-0.1.2 → transcribenpy-1.0.5/src/TranscribeNPy.egg-info}/PKG-INFO +17 -2
- transcribenpy-1.0.5/src/transcribenpy/core.py +44 -0
- transcribenpy-0.1.2/README.md +0 -23
- transcribenpy-0.1.2/src/transcribenpy/core.py +0 -17
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/LICENSE +0 -0
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/MANIFEST.in +0 -0
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/setup.cfg +0 -0
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/src/TranscribeNPy.egg-info/SOURCES.txt +0 -0
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/src/TranscribeNPy.egg-info/dependency_links.txt +0 -0
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/src/TranscribeNPy.egg-info/requires.txt +0 -0
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/src/TranscribeNPy.egg-info/top_level.txt +0 -0
- {transcribenpy-0.1.2 → transcribenpy-1.0.5}/src/transcribenpy/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: TranscribeNPy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: A Python module for recorded audio transcription via Wispr with groq API
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -28,6 +28,21 @@ import os
|
|
|
28
28
|
API_KEY = os.environ.get("GROQ_API_KEY")
|
|
29
29
|
audio_path = "samples/audio.wav"
|
|
30
30
|
|
|
31
|
-
text = transcribe(API_KEY, audio_path)
|
|
31
|
+
text = transcribe(API_KEY, audio_path, model="Precise")
|
|
32
32
|
print(text)
|
|
33
33
|
```
|
|
34
|
+
|
|
35
|
+
## Parameters
|
|
36
|
+
|
|
37
|
+
- `api_key` : String
|
|
38
|
+
- Groq API Key
|
|
39
|
+
- Required
|
|
40
|
+
- `filename` : String
|
|
41
|
+
- Audio file path
|
|
42
|
+
- Default: "samples/audio.wav"
|
|
43
|
+
- `model` : String
|
|
44
|
+
- Model to use for transcription
|
|
45
|
+
- Options:
|
|
46
|
+
- "Fast" / "Quick" / "Fastest" / "Turbo" -> "whisper-large-v3-turbo"
|
|
47
|
+
- "Precise" / "Heavy" / "Slow" -> "whisper-large-v3"
|
|
48
|
+
- Default: "Fast"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# TranscribeNPy
|
|
2
|
+
A python module for transcribing audio files to text via Groq's Whisper-Large-v3/Whisper-Large-v3-turbo
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
```bash
|
|
6
|
+
pip install TranscribeNPy
|
|
7
|
+
```
|
|
8
|
+
or via UV:
|
|
9
|
+
```bash
|
|
10
|
+
uv add TranscribeNPy
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
```python
|
|
15
|
+
from transcribenpy import transcribe
|
|
16
|
+
import os
|
|
17
|
+
|
|
18
|
+
API_KEY = os.environ.get("GROQ_API_KEY")
|
|
19
|
+
audio_path = "samples/audio.wav"
|
|
20
|
+
|
|
21
|
+
text = transcribe(API_KEY, audio_path, model="Precise")
|
|
22
|
+
print(text)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Parameters
|
|
26
|
+
|
|
27
|
+
- `api_key` : String
|
|
28
|
+
- Groq API Key
|
|
29
|
+
- Required
|
|
30
|
+
- `filename` : String
|
|
31
|
+
- Audio file path
|
|
32
|
+
- Default: "samples/audio.wav"
|
|
33
|
+
- `model` : String
|
|
34
|
+
- Model to use for transcription
|
|
35
|
+
- Options:
|
|
36
|
+
- "Fast" / "Quick" / "Fastest" / "Turbo" -> "whisper-large-v3-turbo"
|
|
37
|
+
- "Precise" / "Heavy" / "Slow" -> "whisper-large-v3"
|
|
38
|
+
- Default: "Fast"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: TranscribeNPy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: A Python module for recorded audio transcription via Wispr with groq API
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -28,6 +28,21 @@ import os
|
|
|
28
28
|
API_KEY = os.environ.get("GROQ_API_KEY")
|
|
29
29
|
audio_path = "samples/audio.wav"
|
|
30
30
|
|
|
31
|
-
text = transcribe(API_KEY, audio_path)
|
|
31
|
+
text = transcribe(API_KEY, audio_path, model="Precise")
|
|
32
32
|
print(text)
|
|
33
33
|
```
|
|
34
|
+
|
|
35
|
+
## Parameters
|
|
36
|
+
|
|
37
|
+
- `api_key` : String
|
|
38
|
+
- Groq API Key
|
|
39
|
+
- Required
|
|
40
|
+
- `filename` : String
|
|
41
|
+
- Audio file path
|
|
42
|
+
- Default: "samples/audio.wav"
|
|
43
|
+
- `model` : String
|
|
44
|
+
- Model to use for transcription
|
|
45
|
+
- Options:
|
|
46
|
+
- "Fast" / "Quick" / "Fastest" / "Turbo" -> "whisper-large-v3-turbo"
|
|
47
|
+
- "Precise" / "Heavy" / "Slow" -> "whisper-large-v3"
|
|
48
|
+
- Default: "Fast"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from groq import Groq
|
|
3
|
+
|
|
4
|
+
def isVaild(api_key):
|
|
5
|
+
if not api_key or api_key.strip() == "" or len(api_key) < 5:
|
|
6
|
+
return False
|
|
7
|
+
return True
|
|
8
|
+
|
|
9
|
+
def isFileVaild(filename):
|
|
10
|
+
if (not os.path.exists(filename)) or (not os.path.isfile(filename)) or filename.strip() == "":
|
|
11
|
+
return False
|
|
12
|
+
return True
|
|
13
|
+
|
|
14
|
+
def getModel(model:str):
|
|
15
|
+
if model.lower() == "fast" or model.lower() == "quick" or model.lower() == "fastest" or model.lower() == "turbo":
|
|
16
|
+
return "whisper-large-v3-turbo"
|
|
17
|
+
elif model.lower() == "precise" or model.lower() == "heavy" or model.lower() == "slow":
|
|
18
|
+
return "whisper-large-v3"
|
|
19
|
+
else:
|
|
20
|
+
return "whisper-large-v3-turbo"
|
|
21
|
+
|
|
22
|
+
def transcribe(api_key, filename="samples/audio.wav", model="Fast"):
|
|
23
|
+
if not isVaild(api_key):
|
|
24
|
+
raise ValueError(f"API Key: {api_key} is invalid")
|
|
25
|
+
|
|
26
|
+
if not isFileVaild(filename):
|
|
27
|
+
raise ValueError(f"Audio file: {filename} is invalid")
|
|
28
|
+
|
|
29
|
+
client = Groq(api_key=api_key)
|
|
30
|
+
model = getModel(model)
|
|
31
|
+
|
|
32
|
+
# Open the audio file
|
|
33
|
+
with open(filename, "rb") as file:
|
|
34
|
+
# Create a transcription of the audio file
|
|
35
|
+
transcription = client.audio.transcriptions.create( # API call
|
|
36
|
+
file=file, # Required audio file
|
|
37
|
+
model=model, # Required model to use for transcription
|
|
38
|
+
)
|
|
39
|
+
# To print only the transcription text, you'd use print(transcription.text) (here we're printing the entire transcription object to access timestamps)
|
|
40
|
+
return transcription
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
API_KEY = os.getenv("GROQ_API_KEY")
|
|
44
|
+
print(transcribe(API_KEY, "samples/audio.wav"))
|
transcribenpy-0.1.2/README.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# TranscribeNPy
|
|
2
|
-
A python module for transcribing audio files to text via Groq's Whisper-Large-v3/Whisper-Large-v3-turbo
|
|
3
|
-
|
|
4
|
-
## Installation
|
|
5
|
-
```bash
|
|
6
|
-
pip install TranscribeNPy
|
|
7
|
-
```
|
|
8
|
-
or via UV:
|
|
9
|
-
```bash
|
|
10
|
-
uv add TranscribeNPy
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
```python
|
|
15
|
-
from transcribenpy import transcribe
|
|
16
|
-
import os
|
|
17
|
-
|
|
18
|
-
API_KEY = os.environ.get("GROQ_API_KEY")
|
|
19
|
-
audio_path = "samples/audio.wav"
|
|
20
|
-
|
|
21
|
-
text = transcribe(API_KEY, audio_path)
|
|
22
|
-
print(text)
|
|
23
|
-
```
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from groq import Groq
|
|
3
|
-
|
|
4
|
-
def transcribe(api_key: str, filename: str="samples/audio.wav"):
|
|
5
|
-
|
|
6
|
-
client = Groq(api_key=api_key)
|
|
7
|
-
|
|
8
|
-
# Open the audio file
|
|
9
|
-
with open(filename, "rb") as file:
|
|
10
|
-
# Create a transcription of the audio file
|
|
11
|
-
transcription = client.audio.transcriptions.create( # API call
|
|
12
|
-
file=file, # Required audio file
|
|
13
|
-
model="whisper-large-v3-turbo", # Required model to use for transcription
|
|
14
|
-
)
|
|
15
|
-
# To print only the transcription text, you'd use print(transcription.text) (here we're printing the entire transcription object to access timestamps)
|
|
16
|
-
return transcription
|
|
17
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|