This file contains hidden or 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
| text.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g, ''); |
This file contains hidden or 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 os | |
| import re | |
| if __name__ == "__main__": | |
| root_dir = os.path.join("data", "audios") | |
| os.chdir(root_dir) | |
| files = os.listdir() | |
| pattern = "(.*) \[.*\]\.[a-zA-Z0-9]*(\.wav)" | |
| for file in files: |
This file contains hidden or 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 os | |
| # Initial configuration to overcome '/usr/lib/libsndfile.dylib' (no such file) | |
| # This configuration works when libsndfile is installed with brew. | |
| os.environ["DYLD_LIBRARY_PATH"] = "/opt/homebrew/lib/" |
This file contains hidden or 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 os | |
| filename, file_extension = os.path.splitext(name) |
This file contains hidden or 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 torch | |
| import clip | |
| from PIL import Image | |
| import gradio as gr | |
| if __name__ == "__main__": | |
| device = "cuda" if torch.cuda.is_available() else "cpu" | |
| model, preprocess = clip.load("ViT-B/32", device=device) | |
This file contains hidden or 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 requests | |
| url = "http://localhost:8000/debug" | |
| video_path = '/D:/Desktop/dog_action_dataset/videos/actions/sit/sit_6.mp4' | |
| payload={} | |
| files=[ | |
| ('file',('sit_6.mp4',open(video_path,'rb'),'application/octet-stream')) | |
| ] |
This file contains hidden or 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 numpy as np | |
| import glob | |
| import umap | |
| from tqdm import tqdm | |
| import cv2 | |
| import pandas as pd | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| import os |
This file contains hidden or 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
| mean = [0.485, 0.456, 0.406] | |
| std = [0.229, 0.224, 0.225] |
This file contains hidden or 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
| # Shallow clone for single repo. | |
| git clone --depth 1 https://github.com/user/repo.git | |
| # Shallow clone for repo with submodules. | |
| git clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/user/repo.git | |
This file contains hidden or 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 multiprocessing.pool import ThreadPool | |
| from queue import Empty,Queue | |
| class Executor: | |
| def __init__(self,workers:int = 4,queue_size=8): | |
| self.workers = workers | |
| self.queue_size = queue_size | |
| self.stop = False |