Skip to content

Instantly share code, notes, and snippets.

@Suleman-Elahi
Last active February 13, 2026 15:53
Show Gist options
  • Select an option

  • Save Suleman-Elahi/08fe867c72f8b0adce324d544f95389d to your computer and use it in GitHub Desktop.

Select an option

Save Suleman-Elahi/08fe867c72f8b0adce324d544f95389d to your computer and use it in GitHub Desktop.
pingla_tr.py
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)
@Suleman-Elahi
Copy link
Author

ffmpeg -i audio-sample-4.mp3 -filter:a "atempo=0.70" audio2.wav

For fast audio reduce the audio speed t0 15-30%

@Suleman-Elahi
Copy link
Author

On Linux requires: https://github.com/Purfview/whisper-standalone-win/releases/tag/libs

Extract and set path to LD_LIBRARY_PATH env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment