Last active
February 13, 2026 15:53
-
-
Save Suleman-Elahi/08fe867c72f8b0adce324d544f95389d to your computer and use it in GitHub Desktop.
pingla_tr.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pingala_shunya import PingalaTranscriber | |
| # Initialize with specific backend and settings | |
| transcriber = PingalaTranscriber( | |
| model_name="shunyalabs/pingala-v1-en-verbatim", | |
| backend="ct2", | |
| device="cuda", | |
| compute_type="float16" | |
| ) | |
| # Advanced transcription with full metadata | |
| segments, info = transcriber.transcribe_file( | |
| "audio2.wav", | |
| language='en', | |
| beam_size=16, # Higher beam size for better accuracy | |
| word_timestamps=True, # Enable word-level timestamps | |
| temperature=0.0, # Deterministic output | |
| log_prob_threshold=-1.0, # Filter by probability | |
| no_speech_threshold=None, # Silence detection threshold | |
| initial_prompt="Accurately transcribe this medical dictation", # Guide the model | |
| hotwords="Excelsia", # Boost specific words | |
| vad_filter=False, # Enable voice activity detection | |
| task="transcribe", # or "translate" for translation | |
| condition_on_previous_text=False | |
| ) | |
| # Print transcription info | |
| model_info = transcriber.get_model_info() | |
| print(f"Backend: {model_info['backend']}") | |
| print(f"Model: {model_info['model_name']}") | |
| print(f"Language: {info.language} (confidence: {info.language_probability:.3f})") | |
| print(f"Duration: {info.duration:.2f} seconds") | |
| all_text = [] | |
| for segment in segments: | |
| all_text.append(segment.text.strip()) | |
| # Join all parts with a space and print | |
| full_transcription = " ".join(all_text) | |
| print(full_transcription) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On Linux requires: https://github.com/Purfview/whisper-standalone-win/releases/tag/libs
Extract and set path to LD_LIBRARY_PATH env