Instructions to use kmrabby/crisp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kmrabby/crisp with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="kmrabby/crisp")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("kmrabby/crisp") model = AutoModelForSpeechSeq2Seq.from_pretrained("kmrabby/crisp", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download utils.py from kmrabby/crisp: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/kmrabby/crisp/resolve/main/utils.py
- Command line
-
hf download hf://kmrabby/crisp/utils.py
-
curl -L -o utils.py https://huggingface.co/kmrabby/crisp/resolve/main/utils.py
1.09 kB
| def adjust_pauses_for_hf_pipeline_output(pipeline_output, split_threshold=0.12): | |
| """ | |
| Adjust pause timings by distributing pauses up to the threshold evenly between adjacent words. | |
| """ | |
| adjusted_chunks = pipeline_output["chunks"].copy() | |
| for i in range(len(adjusted_chunks) - 1): | |
| current_chunk = adjusted_chunks[i] | |
| next_chunk = adjusted_chunks[i + 1] | |
| current_start, current_end = current_chunk["timestamp"] | |
| next_start, next_end = next_chunk["timestamp"] | |
| pause_duration = next_start - current_end | |
| if pause_duration > 0: | |
| if pause_duration > split_threshold: | |
| distribute = split_threshold / 2 | |
| else: | |
| distribute = pause_duration / 2 | |
| # Adjust current chunk end time | |
| adjusted_chunks[i]["timestamp"] = (current_start, current_end + distribute) | |
| # Adjust next chunk start time | |
| adjusted_chunks[i + 1]["timestamp"] = (next_start - distribute, next_end) | |
| pipeline_output["chunks"] = adjusted_chunks | |
| return pipeline_output | |