Skip to content

Instantly share code, notes, and snippets.

View pszemraj's full-sized avatar

Peter pszemraj

View GitHub Profile
@pszemraj
pszemraj / text-posts-semantic-search-via-u-s-e.ipynb
Created October 27, 2021 23:57
Text Posts - Semantic Search via U.S.E.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pszemraj
pszemraj / slice_video_dir.py
Created January 31, 2022 13:47
splits all video files in a directory into chunks of a given duration.
"""
slice_video_dir.py - splits all video files in a directory into chunks of a given duration.
credit to https://gist.github.com/agalera/8cd63429b06e21d1420c6030c6b45c53
"""
import argparse
import glob
import os
from moviepy.video.io.VideoFileClip import VideoFileClip
@pszemraj
pszemraj / lfqa-autota-causality.ipynb
Created March 16, 2022 21:48
LFQA AutoTA Causality.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pszemraj
pszemraj / latent-diffusion-text2image-sampling-public.ipynb
Last active May 20, 2022 23:47
latent-diffusion-text2image-sampling-public.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pszemraj
pszemraj / PDF_extract_images.py
Created May 11, 2022 02:21 — forked from gstorer/PDF_extract_images.py
Extract images from a PDF file using Python, Pillow (PIL) and PyPDF2
# coding=utf-8
from __future__ import print_function
"""
The MIT License (MIT)
Copyright (c) 2018 Louis Abraham <[email protected]>
Copyright ©2016 Ronan Paixão
Copyright (c) 2018 Gerald Storer
\x1B[34m\033[F\033[F
@pszemraj
pszemraj / merge_text_files.py
Last active July 24, 2022 23:34
a function in Python that given a string path to a directory, converts it to a pathlib Path object and then loads all text files in the directory. The text files are sorted using the natsorted function and then each file is read and appended to a new file that is all the text files files merged. each file has its filename printed to the file bef…
from natsort import natsorted
from pathlib import Path
import argparse
def merge_files(path, output_path=None, outname=None):
"""
Given a path to a directory, merge all text files in the directory.
"""
path = Path(path)
@pszemraj
pszemraj / text-generation-of-film-scripts-demo.ipynb
Created July 25, 2022 21:07
text generation of film scripts - demo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pszemraj
pszemraj / generate-with-stable-diffusion.ipynb
Last active January 23, 2024 07:44
Generate with stable diffusion
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pszemraj
pszemraj / caption_image.py
Last active January 23, 2024 07:42
basic captioning example using the lavis llibrary
# -*- coding: utf-8 -*-
"""
caption_image.py - basic captioning example using lavis
usage: caption_image.py [-h] -i IMAGE_PATH [-m MODEL_TYPE] [-d DEVICE] [-v VERBOSE]
# lavis
https://github.com/salesforce/LAVIS
"""
@pszemraj
pszemraj / stable-dreamfusion-notebook.ipynb
Last active October 9, 2022 17:02
stable-dreamfusion-notebook.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.