Skip to content

Instantly share code, notes, and snippets.

View Proteusiq's full-sized avatar

Prayson Wilfred Daniel Proteusiq

View GitHub Profile
@Proteusiq
Proteusiq / fast_speech_text_speech.py
Last active March 29, 2024 14:08 — forked from thomwolf/fast_speech_text_speech.py
speech to text to speech
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
pip install whisper pynput pyaudio
"""
from openai import OpenAI
import time
#!/bin/bash
sudo apt update -y
sudo apt install git gcc make openssl libssl-dev \
libbz2-dev libreadline-dev libsqlite3-dev zlib1g-dev \
libncursesw5-dev libgdbm-dev libc6-dev zlib1g-dev libsqlite3-dev \
tk-dev libssl-dev openssl libffi-dev \
-y
# install
@Proteusiq
Proteusiq / datacache.py
Created July 10, 2021 06:42
Share objects
import json
import zlib
from typing import Any, Optional, Dict
import diskcache as dc
class DataCache:
def __init__(
self,
cache_path: str,
from datetime import datetime
from uuid import UUID, uuid4
from typing import Literal, Optional, Union
from pydantic import BaseModel, Field, ValidationError, validator, constr, confloat
class HouseDataValidation(BaseModel):
id: Union[int, UUID] = Field(default_factory=uuid4)
kind: Literal["villa", "apartment", "townhouse"]
from pathlib import Path
from PIL import Image
# get all png images from folder `gotoslides`
SLIDES_IMAGES = Path("gotoslides").glob("*.png")
# maybe use a generator | convert RGB (since its png)
images = [Image.open(image).convert("RGB") for image in SLIDES_IMAGES]
with open("gotoslides.pdf", "wb") as pdf_file:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Using pyPDF2 and requests(or httpx) to extract PDF data
import io
import requests
import PyPDF2
# my favorite Kierkegard's PDF book
URI = "https://antilogicalism.com/wp-content/uploads/2017/07/thesicknessuntodeath.pdf"
headers = {"user-agent": "Prayson W. Daniel: prayson*at*.com"}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.