This file contains 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
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. | |
This file contains 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
# 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 | |
# |
This file contains 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
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( |
This file contains 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
# 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 |