Skip to content

Instantly share code, notes, and snippets.

@sebington
sebington / file_frequency.py
Last active March 27, 2025 15:51
Mon premier script en Python !
# This script is destined to be executed in a directory containing a series of files with a 'yyyymmdd' naming pattern
# e.g. "20240621_212441.wav". The script will parse the date in each filename and plot the number of files per year-month.
import os
import fnmatch
import matplotlib.pyplot as plt
# create empty list
list1=[]
@sebington
sebington / batch_faster_whisper.ipynb
Created December 26, 2024 22:20
Batch transcribe audio/video files using Faster-Whisper
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sebington
sebington / whisper_batch_groq.ipynb
Created December 26, 2024 22:28
Batch transcribe audio/video files using Groq Whisper
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sebington
sebington / whisper_groq2srt.py
Last active March 30, 2025 12:34
Transcribe an audio/video file with Groq Whisper
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "groq",
# ]
# ///
from groq import Groq
import math
client = Groq()
@sebington
sebington / whisper_groq2srt_claude.py
Last active February 1, 2025 01:36
Transcribe an audio/video file with Groq Whisper
import os
import math
import tkinter as tk
from tkinter import filedialog, messagebox
from typing import Dict, Optional
from groq import Groq
import logging
# Configure logging
logging.basicConfig(
@sebington
sebington / whisper_groq2srt_shorter.py
Last active March 25, 2025 19:52
Transcribe an audio/video file with Groq Whisper
from groq import Groq
from datetime import timedelta
def format_time(seconds):
# Ensure the first segment starts at 00:00:00,000
if float(seconds) < 0.001:
return "00:00:00,000"
time = str(timedelta(seconds=float(seconds))).replace('.', ',')[:-3]
return f"{time:0>12}"
@sebington
sebington / batch_whisper.ipynb
Created December 27, 2024 14:58
Batch transcribe audio/video files with OpenAI Whisper
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sebington
sebington / faster-whisper_word-level.ipynb
Last active February 1, 2025 01:36
Transcribe audio file at word-level and write output to .srt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sebington
sebington / r1-cpu.py
Last active February 8, 2025 16:25
CPU-friendly version of vgel's r1.py script (https://gist.github.com/vgel/8a2497dc45b1ded33287fa7bb6cc1adc)
# Generated with Claude 3.5 Sonnet using vgel's r1.py script + the following prompt:
# "Can you modify this script to improve inference speed on a CPU-only PC?"
# It is possible to define the number of threads (= CPU cores) in the prompt
# Example run : python r1-cpu.py -t 32 "What is 1+1?" --threads 4
import argparse
import random
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache