Skip to content

Instantly share code, notes, and snippets.

View Wazzabeee's full-sized avatar
🐠

Clement Delteil Wazzabeee

🐠
View GitHub Profile
@Wazzabeee
Wazzabeee / interface.py
Created June 25, 2023 22:17
Streamlit App P1
import streamlit as st
import requests
from streamlit_lottie import st_lottie
# Define a function that we can use to load lottie files from a link.
@st.cache_data()
def load_lottieurl(url: str):
r = requests.get(url)
if r.status_code != 200:
return None
@Wazzabeee
Wazzabeee / wav_to_tfrecord.py
Created April 23, 2023 22:41
Python script that converts WAV files to TFRecord format with label one hot encoded
import os
import tensorflow as tf
import librosa
import numpy as np
def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
@Wazzabeee
Wazzabeee / get_wav_duration.py
Last active August 3, 2025 03:36
Get total duration of WAV files in given directory
import os
import sys
import wave
# Get the path to the directory from the command-line argument
if len(sys.argv) < 2:
print("Usage: python script.py <directory>")
sys.exit(1)
root_dir = sys.argv[1]
@Wazzabeee
Wazzabeee / mp3_to_wav.py
Created April 23, 2023 21:39
Convert MP3 files to WAV files with specified sampling rate
import os
import argparse
import subprocess
import shutil
from pathlib import Path
def convert_mp3_to_wav(mp3_file_path, output_dir, sample_rate):
# extract the file name and extension
mp3_file_name = os.path.basename(mp3_file_path)
@Wazzabeee
Wazzabeee / test_simple.py
Created January 21, 2023 18:41
Python script used in PlotNeuralNet package
import sys
sys.path.append('../')
from pycore.tikzeng import *
# defined your arch
arch = [
to_head( '..' ),
to_cor(),
to_begin(),
to_Conv("conv1", 512, 64, offset="(0,0,0)", to="(0,0,0)", height=64, depth=64, width=2 ),
@Wazzabeee
Wazzabeee / Sample.tex
Created January 21, 2023 18:39
Sample of the full test_simple.tex file
\pic[shift={(0,0,0)}] at (0,0,0)
{Box={
name=conv1,
caption= ,
xlabel={{64, }},
zlabel=512,
fill=\ConvColor,
height=64,
width=2,
depth=64
@Wazzabeee
Wazzabeee / CNN_ChatGPT.tex
Last active January 21, 2023 01:37
LaTeX code generated from ChatGPT to visualize a Convolutional Neural Network (CNN) from the PlotNeuralNet package
\documentclass[border=15pt, multi, tikz]{standalone}
\usepackage{import}
\subimport{layers/}{init}
\usetikzlibrary{positioning}
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
\def\PoolColor{rgb:red,1;black,0.3}
\begin{document}
@Wazzabeee
Wazzabeee / test_simple.tex
Created January 21, 2023 00:40
LaTeX code generated from test_simple.py using PlotNeuralNet package
\documentclass[border=8pt, multi, tikz]{standalone}
\usepackage{import}
\subimport{../layers/}{init}
\usetikzlibrary{positioning}
\usetikzlibrary{3d} %for including external image
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
\def\PoolColor{rgb:red,1;black,0.3}
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
@Wazzabeee
Wazzabeee / twitter_cron_job.pyw
Last active January 19, 2023 01:37
Python script used to automate the scraping of recent tweets using a custom query via the Twitter API and the Tweepy library to build a dataset. This dataset contains tweets about Elon Musk's person and was used for sentimental analysis purposes.
import json
import os
import tweepy as tw
CONSUMER_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXX'
CONSUMER_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
ACCESS_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
ACCESS_TOKEN_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
BEARER_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \