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 pathlib import Path | |
import re | |
images = list(Path('./frames').glob('*.png')) | |
n_frames = len(images) | |
def get_frame_index(fpath): | |
fpath = str(fpath) | |
match = re.findall('[0-9]+', fpath) | |
if match: |
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
scene1 {transition: t0} | scene2 {transition: t1} | scene3 {transition: t0} | scene4 | |
scenes: | |
scene1: | |
prompts: | |
- foo | |
- bar | |
scene2: | |
prompts: | |
- baz |
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
# via https://github.com/Stability-AI/stablediffusion/blob/main/ldm/util.py | |
def instantiate_from_config(config): | |
if not "target" in config: | |
if config == '__is_first_stage__': | |
return None | |
elif config == "__is_unconditional__": | |
return None | |
raise KeyError("Expected key `target` to instantiate.") | |
return get_obj_from_str(config["target"])(**config.get("params", dict())) |
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
############### | |
# DreamStudio # | |
############### | |
import PIL | |
from PIL import Image, ExifTags | |
def get_exif(img): | |
outv = {} | |
for k, v in img.getexif().items(): |
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
#@title Prompts | |
prompts = { | |
0:"unfortunate failed crayon drawing sketched while drunk looks awful, should have thrown it away, badly drawn crayon sketch of bill murray scribbled by a child while having a stroke seizure, wouldnt even put this on my fridge, by five year old could've drawn this", | |
50:"unfortunate failed crayon drawing sketched while drunk looks awful, should have thrown it away, badly drawn crayon sketch CARICATURE of bill murray scribbled by a child while having a stroke seizure, wouldnt even put this on my fridge, by five year old could've drawn this", | |
150:"crayon drawing sketched while drunk looks awful, should have thrown it away, badly drawn crayon sketch of bill murray scribbled by a child while having a stroke seizure, wouldnt even put this on my fridge, by five year old could've drawn this", | |
200:"crayon drawing sketched while drunk, hastily drawn crayon sketch of bill murray scribbled by a child while having a stroke seizure, wouldnt even put this on my fridge, by five ye |
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
""" | |
It looks like the Scene and Storyboard classes are intended to be used for creating animations by specifying keyframed curves for various parameters. The Scene class appears to allow users to specify the length of the scene and set keyframed curves for various attributes of the scene. The Storyboard class then allows users to create a sequence of Scene objects and specify default values for attributes that are not explicitly set in a given scene. | |
It looks like the KeyframedObject class is a subclass of the Keyframed class from the keyframed module, which provides some basic functionality for working with keyframed curves. The KeyframedObject class adds a weight attribute to the Keyframed class, which specifies the weight of the object when it is used in a storyboard. | |
The to_keyframed function provides a convenient way to convert various types of input into Keyframed objects, which can then be used as attributes in a Scene object. This function allows users to specify keyframed curves using strings, d |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
library(MASS) | |
library(rpart) | |
random_pos_def_matrix = function(n){ | |
# https://math.stackexchange.com/a/358092/109246 | |
A = matrix(runif(n*n), n) | |
A = 0.5*(A+t(A)) | |
A + n*diag(n) | |
} |
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
library(tidyr) # just for gather() | |
simulate <- function(formulas | |
,obs_per_cell = 100 | |
,n_cells_per_group = 3 | |
,amp_mu = 50 | |
,amp_sd = 1 # this is only thing that impacts sd | |
,true_effect = 3 | |
,error_sd = 1 | |
){ |
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
install.packages('doParallel') | |
library(igraph) | |
library(foreach) | |
library(doParallel) | |
stopCluster(cl) | |
cl <- makeCluster(8) | |
registerDoParallel(cl) | |
sj_alg <- function(G){ |