These are mapping files that go between class IDs to class names. These are generated from the training CSV files from each dataset by collecting the unique classes, sorting them, and then numbering them from 0 upwards.
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 json | |
import openai | |
openai.api_key = "sk-" | |
def classifier(description, labels, label_descriptions): | |
def classify(text): | |
function = { | |
"name": "Classify", | |
"description": description, |
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 re | |
import time | |
import requests | |
import logging as logme | |
class TokenExpiryException(Exception): | |
def __init__(self, msg): | |
super().__init__(msg) |
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
""" | |
Convert YouTube subtitles(vtt) to human readable text. | |
Download only subtitles from YouTube with youtube-dl: | |
youtube-dl --skip-download --convert-subs vtt <video_url> | |
Note that default subtitle format provided by YouTube is ass, which is hard | |
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which | |
is easier to process. |
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
//credit - https://huggingface.co/blog/fine-tune-wav2vec2-english (Patrick von Platen) | |
// run this on your Chrome / Browser Console (where Colab is present) | |
function ConnectButton(){ | |
console.log("Connect pushed"); | |
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click() | |
} | |
var colab = setInterval(ConnectButton,60000); |
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 spacy | |
>>> nlp = spacy.load("en_core_sci_lg") | |
>>> text = """spaCy is an open-source software library for advanced natural language processing, | |
written in the programming languages Python and Cython. The library is published under the MIT license | |
and its main developers are Matthew Honnibal and Ines Montani, the founders of the software company Explosion.""" | |
>>> doc = nlp(text) | |
>>> print(doc.ents) | |
(spaCy, open-source software library, written, programming languages, | |
Python, Cython, library, MIT, license, developers, Matthew Honnibal, | |
Ines, Montani, founders, software company) |
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
javascript:void(open('http://archive.today/?run=1&url='+encodeURIComponent(document.location))) |
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
from functools import partial | |
import numpy as np | |
from tqdm import tqdm | |
LUT_SIZE = 33 | |
def _convert(pixel, lut): | |
r, g, b = map(lambda x: round((x / 255) * LUT_SIZE - 1), pixel) | |
idx = r + g * LUT_SIZE + b * (LUT_SIZE ** 2) |
NewerOlder