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 pylast | |
import pandas as pd | |
from tqdm import tqdm | |
API_KEY_lastfm = "key_here" | |
API_SECRET_lastfm = " key_here" | |
username_lastfm = "username" | |
def build_dataset_by_tag(tag_list,output_file): | |
print('[INFO] Bulding Dataset by Tag....') | |
network_lastfm = pylast.LastFMNetwork(api_key=API_KEY_lastfm, api_secret=API_SECRET_lastfm,username=username_lastfm) |
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 csv | |
import pandas as pd | |
import googleapiclient | |
from tqdm import tqdm | |
DEVELOPER_KEY_GCP = "key_here" | |
def get_video_id_from_youtube(df): | |
# Disable OAuthlib's HTTPS verification when running locally. | |
# *DO NOT* leave this option enabled in production. |
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 youtube_dl | |
import pandas as pd | |
def get_youtube_music(row): | |
path = 'data/music/{}/{}.mp3'.format(row['style'],str(row['uuid'])) | |
exists = os.path.isfile(path) | |
if exists: | |
print('Already exist {}'.format(row['uuid'])) | |
return | |
if row['videoID_youtube'] != "missing": | |
videoID = row['videoID_youtube'] |
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 librosa | |
import numpy as np | |
import pandas as pd | |
from tqdm import tqdm | |
def extract_features_from_a_song(x,sr): | |
dict_features = { | |
'zcr': np.mean(librosa.feature.zero_crossing_rate(x)), | |
'chroma_stft': np.mean(librosa.feature.chroma_stft(x, sr=sr)), | |
'mfcc': np.mean(librosa.feature.mfcc(x, sr=sr)), |
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
def reduce_mem_usage(df): | |
""" iterate through all the columns of a dataframe and modify the data type | |
to reduce memory usage. | |
""" | |
start_mem = df.memory_usage().sum() / 1024 ** 2 | |
print('Memory usage of dataframe is {:.2f} MB'.format(start_mem)) | |
for col in df.columns: | |
col_type = df[col].dtype |
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
def reduce_mem_usage(df): | |
""" iterate through all the columns of a dataframe and modify the data type | |
to reduce memory usage. | |
""" | |
start_mem = df.memory_usage().sum() / 1024 ** 2 | |
print('Memory usage of dataframe is {:.2f} MB'.format(start_mem)) | |
for col in df.columns: | |
col_type = df[col].dtype |
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 cv2 | |
import dlib | |
import PIL.Image | |
import numpy as np | |
from imutils import face_utils | |
import argparse | |
from pathlib import Path | |
import os | |
import ntpath |
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
print('[INFO] Starting System...') | |
print('[INFO] Importing pretrained model..') | |
pose_predictor_68_point = dlib.shape_predictor("pretrained_model/shape_predictor_68_face_landmarks.dat") | |
pose_predictor_5_point = dlib.shape_predictor("pretrained_model/shape_predictor_5_face_landmarks.dat") | |
face_encoder = dlib.face_recognition_model_v1("pretrained_model/dlib_face_recognition_resnet_model_v1.dat") | |
face_detector = dlib.get_frontal_face_detector() | |
print('[INFO] Importing pretrained model..') |
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 React, { useEffect, useRef } from 'react'; | |
import * as THREE from 'three'; | |
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer'; | |
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass'; | |
import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass'; | |
import { OutputPass } from 'three/examples/jsm/postprocessing/OutputPass'; | |
import ShaderCode from './ShaderCode'; | |
const AudioVisualizer3D = ({ audioStream, type }) => { | |
const { vertexShader, fragmentShader } = ShaderCode(); |