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 tensorflow as tf | |
import tensorflow_io as tfio | |
tensor = tf.cast(audio_tensor, tf.float32) / 32768.0 | |
spectrogram = tfio.audio.spectrogram( | |
tensor, nfft=512, window=512, stride=256) | |
mel_spectrogram= tfio.audio.melscale( | |
spectrogram, rate=16000, mels=128, fmin=0, fmax=8000) |
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 tensorflow as tf | |
n = len(x) | |
T = 1/samples | |
yf = tf.signal.fft(ys) | |
xf = np.linspace(0.0, 1.0/(2.0*T), int(n/2)) | |
plt.plot(xf, 2.0/n*np.abs(yf[:n//2])) |
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
!pip install -q "tensorflow_io==0.28.*" | |
!curl -O https://storage.googleapis.com/audioset/miaow_16k.wav | |
import tensorflow as tf | |
import tensorflow_io as tfio | |
from IPython.display import Audio | |
audio = tfio.audio.AudioIOTensor('miaow_16k.wav') |
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 | |
plt.figure(figsize=(14,10)) | |
def show_frequency(x, y, i): | |
plt.subplot(3, 1, i) | |
plt.stem(x, y, 'r', use_line_collection=True) | |
plt.plot(x, y) | |
plt.xlabel("time") |
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 pandas as pd | |
import numpy as np | |
import plotly.express as px | |
df = pd.read_csv("kaggle_survey_2022_responses.csv") | |
def plot_answers(data, question_prefix, year): | |
filter_columns = [col for col in data.columns if col.startswith(question_prefix)] | |
df = data[filter_columns] | |
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('this is Python file to test some magics') | |
def my_function(a, b, c): | |
print(a, b, c) | |
return a + b + c |
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(len("✋")) | |
print(len("✋🏾")) | |
print(len("👪")) | |
print(len("👨👨👧👦")) | |
print(len("👨👧👦")) | |
print(len("👨👦")) |