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
| # Model code | |
| import tensorflow as tf | |
| from tensorflow.keras import layers | |
| class Model(tf.Module): | |
| def __init__(self, output_size, name="iris_model"): | |
| super().__init__(name=name) | |
| self.d1 = layers.Dense(64, activation='relu') | |
| self.d2 = layers.Dense(64, activation='relu') |
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 time | |
| import timeit | |
| batch_size = 5000 | |
| datasets = 4 | |
| data = [np.ones(100)] * datasets | |
| def opt1(): | |
| batches = [] |
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 moviepy.video.compositing.concatenate import concatenate_videoclips | |
| from skimage.filters import gaussian | |
| from moviepy.editor import VideoFileClip, clips_array, concatenate_videoclips | |
| def blur(image): | |
| """ Returns a blurred (radius=4 pixels) version of the image """ | |
| return gaussian(image.astype(float), sigma=4) | |
| # open video and resize to 460 | |
| clip1 = VideoFileClip("cat1.mp4").subclip(1,2).resize(width=200) |
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
| # Add this to your `~/.bash_profile` or `~/.zshrc` file, | |
| # so that running the Python script in the terminal is more convenient. | |
| # Command: yvt URL START_TIME END_TIME | |
| # Sample: yvt 'https://www.youtube.com/watch?v=RjxKVAOZCQY' 9:41 10:58 | |
| yt_video_trimmer() { | |
| python <PATH TO>/yt-video-trimmer.py $1 $2 $3 | |
| } | |
| alias yvt=yt_video_trimmer |
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 moviepy | |
| from moviepy.editor import VideoFileClip, concatenate_videoclips | |
| import glob | |
| files = glob.glob("*." + suffix) | |
| files = [VideoFileClip(file) for file in files] | |
| final_video = concatenate_videoclips(files) | |
| final_video.write_videofile(outputPath.split(".")[0] + ".mp4") | |
| if __name__ == "__main__": |
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 scipy | |
| import moviepy.editor | |
| grid_size = [3,3] | |
| duration_sec = 5 | |
| smoothing_sec = 1.0 | |
| image_zoom = 1 | |
| fps = 15 | |
| random_seed = np.random.randint(0, 999) |
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 moviepy.editor import * # pip install moviepy | |
| import argparse # pip install argparse | |
| def display_text_on_video(video: str, text: str, path: str) -> None: | |
| """ | |
| Show text at the center of a video and save the new video version in a specific location. | |
| Parameters: | |
| video (str): The path of the video to edit | |
| text (str): The text to be overlaid on the video |
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
| # git clone https://github.com/NVlabs/stylegan2 | |
| import os | |
| import numpy as np | |
| from scipy.interpolate import interp1d | |
| from scipy.io import wavfile | |
| import matplotlib.pyplot as plt | |
| import PIL.Image | |
| import moviepy.editor | |
| import dnnlib |
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 math | |
| from moviepy.editor import concatenate, ImageClip | |
| import os | |
| import platform | |
| import subprocess | |
| import random | |
| import torch | |
| # pip install pytorch-pretrained-biggan | |
| from pytorch_pretrained_biggan import (BigGAN, truncated_noise_sample, convert_to_images) | |
| import numpy as np |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder