This file contains 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
import os | |
import time | |
from typing import Optional, Tuple | |
import torch | |
from PIL import Image | |
import onnxruntime as onnxrt | |
import requests | |
from transformers import AutoConfig, AutoModelForVision2Seq, TrOCRProcessor, VisionEncoderDecoderModel |
This file contains 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
var message = new MimeMessage(); | |
message.From.Add(new MailboxAddress("Your Name", "your-email@yourdomain.com")); | |
message.To.Add(new MailboxAddress("", recipientEmail)); | |
message.Subject = subject; | |
message.Body = new TextPart("html") | |
{ | |
Text = body | |
}; |
This file contains 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
#!/bin/bash | |
### steps #### | |
# verify the system has a cuda-capable gpu | |
# download and install the nvidia cuda toolkit and cudnn | |
# setup environmental variables | |
# verify the installation | |
### | |
### to verify your gpu is cuda enable check |
This file contains 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
#!/bin/bash | |
## This gist contains instructions about cuda v10.1 and cudnn 7.6 installation in Ubuntu 18.04 for Tensorflow 2.1.0 | |
### steps #### | |
# verify the system has a cuda-capable gpu | |
# download and install the nvidia cuda toolkit and cudnn | |
# setup environmental variables | |
# verify the installation | |
### |
This file contains 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
total_parameters = 0 | |
for variable in tf.trainable_variables(): | |
# shape is an array of tf.Dimension | |
shape = variable.get_shape() | |
print(shape) | |
variable_parameters = 1 | |
for dim in shape: | |
variable_parameters *= dim.value | |
total_parameters += variable_parameters | |
print(f'TOTAL: {total_parameters}') |
This file contains 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
for (size_t n = 0; n < totalFrameCnt / 160; n++) { | |
get_frame_f32(pWavIn, frameIn, 160); | |
float *input = (float *)malloc(480 * sizeof(float)); | |
float *output = (float *)malloc(160 * sizeof(float)); | |
//Upsample from 16KHz to 48KHz | |
Resample_f32(frameIn, input, 16000, 48000, 160, 1); | |
float prob = rnnoise_process(pRnnoise, frameOut, input); | |
if (isOutput) { |
This file contains 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
import librosa | |
import librosa.filters | |
import numpy as np | |
import tensorflow as tf | |
from scipy import signal | |
from scipy.io import wavfile | |
def save_wavenet_wav(wav, path, sr, inv_preemphasize, k): | |
# wav = inv_preemphasis(wav, k, inv_preemphasize) | |
wav *= 32767 / max(0.01, np.max(np.abs(wav))) |
This file contains 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
using DeepSpeechClient; | |
using DeepSpeechClient.Interfaces; | |
using DeepSpeechClient.Models; | |
using NAudio.Wave; | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; |
This file contains 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
import spacy | |
from spacy import displacy | |
from spacy.lang.es.examples import sentences | |
f = open("result.txt", mode="w+", encoding="utf-8") | |
with open('data.txt', mode="r", encoding="utf-8") as file: | |
data = file.read().replace('\n', '') | |
nlp = spacy.load('es_core_news_sm', disable=['ner', 'textcat']) | |
doc = nlp(data) |