Skip to content

Instantly share code, notes, and snippets.

View abodacs's full-sized avatar

Abdullah Mohammed abodacs

View GitHub Profile
#pip install git+https://github.com/huggingface/transformers.git
import datetime
import sys
from transformers import pipeline
from transformers.pipelines.audio_utils import ffmpeg_microphone_live
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=0)
sampling_rate = pipe.feature_extractor.sampling_rate
@abodacs
abodacs / GPT4all-langchain-demo.ipynb
Created April 4, 2023 10:52 — forked from psychemedia/GPT4all-langchain-demo.ipynb
Example of running GPT4all local LLM via langchain in a Jupyter notebook (Python)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from sentence_transformers import SentenceTransformer, util
import torch
# save model in current directory
model = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2', device='cpu', cache_folder='./')
# save model in models folder (you need to create the folder on your own beforehand)
# model = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2', device='cpu', cache_folder='./models/')
# Corpus with example sentences
corpus = [
#!/usr/bin/python
# -*- coding=utf-8 -*-
"""
An example of cleaning arabic text with PyArbic Library
Requirements: pip install pyarabic
Data: text file
Ouput: text file ( cleaned)
"""
import sys
from phonemizer.backend import EspeakBackend
backend = EspeakBackend('en-us', preserve_punctuation=True, with_stress=True)
text = ["Hello, world!", "Welcome to Medium!"]
phonemized = backend.phonemize(text, strip=True)
print(phonemized)
@abodacs
abodacs / whisper-transcribe.bash
Created November 9, 2022 08:49 — forked from DaniruKun/whisper-transcribe.bash
Transcribe (and translate) any VOD (e.g. from Youtube) using Whisper from OpenAI and embed subtitles!
#!/usr/bin/env bash
# Small shell script to more easily automatically download and transcribe live stream VODs.
# This uses YT-DLP, ffmpeg and the CPP version of Whisper: https://github.com/ggerganov/whisper.cpp
# Use `./transcribe-vod help` to print help info.
# MIT License
# Copyright (c) 2022 Daniils Petrovs
@abodacs
abodacs / gsoc_2022_work_product.md
Created October 11, 2022 22:33 — forked from yuroitaki/gsoc_2022_work_product.md
This document summarises the work that I have done as part of Google Summer of Code 2022.

Google Summer of Code 2022 Work Product

This document summarises the work that I have done as part of Google Summer of Code 2022 (GSoC).

Summary

@abodacs
abodacs / video-subtitles-via-whisper.py
Created September 25, 2022 19:26 — forked from rasbt/video-subtitles-via-whisper.py
Script that creates subtitles (closed captions) for all MP4 video files in your current directory
# Sebastian Raschka 09/24/2022
# Create a new conda environment and packages
# conda create -n whisper python=3.9
# conda activate whisper
# conda install mlxtend -c conda-forge
# Install ffmpeg
# macOS & homebrew
# brew install ffmpeg
# Ubuntu
const routes = {
home: '/',
transactions: '/transactions',
transactionDetails: '/transactions/:uuid',
}
const urls: Record<
keyof typeof routes,
{ get: (params?: any) => string; route: string }
> = new Proxy(routes, {
@abodacs
abodacs / dotnetlayout.md
Created June 26, 2022 16:35 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/