C++ links: Coroutines
https://github.com/MattPD/cpplinks / C++ Standard / C++20 / Coroutines
(draft; work in progress)
#coroutines (C++ Slack): https://cpplang.slack.com/archives/C5JS5JXT5
https://github.com/MattPD/cpplinks / C++ Standard / C++20 / Coroutines
(draft; work in progress)
#coroutines (C++ Slack): https://cpplang.slack.com/archives/C5JS5JXT5
import whisper | |
import pyaudio | |
import wave | |
import sys | |
import tempfile | |
from ctypes import * | |
# Load the Whisper model once | |
model = whisper.load_model("base.en") |
import struct | |
import io | |
class WAVFile: | |
def __init__(self, filename): | |
self.filename = filename | |
def read(self): | |
with io.open(self.filename, 'rb') as fh: |
""" | |
This gist shows how to run asyncio loop in a separate thread. | |
It could be useful if you want to mix sync and async code together. | |
Python 3.7+ | |
""" | |
import asyncio | |
from datetime import datetime | |
from threading import Thread | |
from typing import Tuple, List, Iterable |
sudo apt-get install libgnome-keyring-dev | |
cd /usr/share/doc/git/contrib/credential/gnome-keyring | |
sudo make | |
sudo ln -s /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring /usr/lib/git-core/ |
from scipy.io.wavfile import read, write | |
import io | |
## This may look a bit intricate/useless, considering the fact that scipy's read() and write() function already return a | |
## numpy ndarray, but the BytesIO "hack" may be useful in case you get the wav not through a file, but trough some websocket or | |
## HTTP Post request. This should obviously work with any other sound format, as long as you have the proper decoding function | |
with open("input_wav.wav", "rb") as wavfile: | |
input_wav = wavfile.read() |
import asyncio | |
import itertools | |
import json | |
import logging | |
import time | |
import graphene | |
import uvicorn | |
from graphql.execution.executors.asyncio import AsyncioExecutor | |
from starlette.applications import Starlette |
import asyncio | |
import json | |
import logging | |
from uuid import UUID | |
import aio_pika | |
import websockets.exceptions as ws_exc | |
from fastapi import APIRouter, Path | |
from starlette import status | |
from starlette.websockets import WebSocket |