This file contains hidden or 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 re | |
import json | |
import requests | |
HOSTNAME = "https://imperial.cloud.panopto.eu" | |
HOME_FOLDER = "{HOME_FOLDER_ID}" | |
PLAYLIST_FILE = "panopto.xspf" | |
COOKIE_FILE = "cookie.txt" | |
OUTPUT_FILE = "videos.json" |
This file contains hidden or 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
{ | |
"input": "generated.txt", | |
"output": "output.mp3", | |
"delimiters": { | |
"dialog": "\n\n", | |
"speaker": ":\n" | |
}, | |
"voices": { | |
"JOE ROGAN": { | |
"type": "en-US-Wavenet-A", |
This file contains hidden or 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
from google.cloud import texttospeech | |
import json | |
def tts(voice, dialog): | |
client = texttospeech.TextToSpeechClient() | |
input_text = texttospeech.SynthesisInput(text=dialog) | |
voice_config = texttospeech.VoiceSelectionParams( | |
language_code="en-US", |
This file contains hidden or 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
gen_file = 'gpt2_gentext_{:%Y%m%d_%H%M%S}.txt'.format(datetime.utcnow()) | |
gpt2.generate_to_file(sess, | |
destination_path=gen_file, | |
length=500, | |
temperature=0.7, | |
nsamples=100, | |
batch_size=20 | |
) |
This file contains hidden or 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
gpt2.copy_checkpoint_from_gdrive(run_name='run1') | |
sess = gpt2.start_tf_sess() | |
gpt2.load_gpt2(sess, run_name='run1') | |
gpt2.generate(sess, | |
length=800, | |
temperature=0.7, | |
prefix="JOE ROGAN:", | |
nsamples=5, |
This file contains hidden or 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
gpt2.finetune(sess, | |
dataset=file_name, | |
model_name='355M', | |
steps=1000, | |
restore_from='fresh', | |
run_name='run1', | |
print_every=10, | |
sample_every=200, | |
save_every=500 | |
) |
This file contains hidden or 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
gpt2.download_gpt2(model_name="355M") | |
file_name = "transcripts.txt" | |
gpt2.copy_file_from_gdrive(file_name) | |
sess = gpt2.start_tf_sess() |
This file contains hidden or 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
# %tensorflow_version 1.x | |
# !pip install -q gpt-2-simple | |
import gpt_2_simple as gpt2 | |
from datetime import datetime | |
from google.colab import files |
This file contains hidden or 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 re | |
with open('transcriptsOriginal.txt', 'r', encoding="utf8") as file: | |
data = file.read() | |
pattern = '\(.*\)\n|\[.*]|\(.*\)|PART.*]|…|Jamie:.*(.|\?)|[\?]|--|\.\.\.\s|Jaime(\n|.)*?\].' | |
result = re.sub(pattern, ' ', data) | |
result = result.replace('Elon Musk: ', 'ELON MUSK:\n') | |
result = result.replace('Joe Rogan: ', 'JOE ROGAN:\n') |
This file contains hidden or 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
// When an ad is detected, this script mutes the Spotify music player and plays custom audio files instead | |
// Paste in console of web app / PWA | |
// Add your own audio file URLs below to replace the ads | |
// Or empty to play nothing | |
//-------------------------------------------------------// | |
let tunes = [ |
NewerOlder