Skip to content

Instantly share code, notes, and snippets.

View ritwikraha's full-sized avatar
🎲
learning is probabilistic.

Ritwik Raha ritwikraha

🎲
learning is probabilistic.
View GitHub Profile
@rasbt
rasbt / whisper-audio-to-text.py
Created January 26, 2023 17:46
Transcribes audio files using OpenAI Whisper
# Setup:
# conda create -n whisper python=3.9
# conda activate whisper
# https://github.com/openai/whisper
# pip install git+https://github.com/openai/whisper.git
# Usage:
# python whisper-audio-to-text.py --audio_dir my_files --out_dir texts
import argparse
@ariG23498
ariG23498 / transformer_block.py
Last active March 16, 2022 07:01
Just a transformer block impelemented in TensorFlow Keras
class TransformerBlock(layers.Layer):
"""A generic Transformer block with MHSA and MLP layers.
Args:
config: The configuration of the architecture.
"""
def __init__(self, config, **kwargs):
super().__init__(**kwargs)
self.config = config
self.layer_norm1 = layers.LayerNormalization(
@sksavant
sksavant / get_text_overlay.py
Last active March 3, 2020 10:07
Vectorly Coding Question
# This is the problem for First technical round for the role of Computer Vision Engineer at Vectorly
# More details at https://www.linkedin.com/jobs/view/1629909785/
#
# Write a function which will segment and extract the text overlay "Bart & Homer's EXCELLENT Adventure"
# Input image is at https://vectorly.io/demo/simpsons_frame0.png
# Output : Image with only the overlay visible and everything else white
#
# Note that you don't need to extract the text, the output is an image with only
# the overlay visible and everything else (background) white
#
@soply
soply / disp_multiple_images.py
Last active January 9, 2024 14:52
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
def show_images(images, cols = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.