Skip to content

Instantly share code, notes, and snippets.

URL = 'https://kaushikshresth12-kaushikbhaiyakaserver.hf.space/generate-text'
def format_prompt(message, custom_instructions=None):
prompt = ""
if custom_instructions:
prompt += f"[INST] {custom_instructions} [/INST]"
prompt += f"[INST] {message} [/INST]"
return prompt
instructions_L1 = """
# https://readloud.net/english/british/1-male-voice-brian.html
# pip install selenium chromedriver_autoinstaller
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from time import sleep
from chromedriver_autoinstaller import install
import pygame
import random
import asyncio
import edge_tts
import os
allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 :,.?!"
def remove_special_chars(text):
newtxt=""
# pip install webdriver_manager
# pip install selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
<!DOCTYPE html>
<html lang="en">
<head>
<title>Speech Recognition</title>
</head>
<body>
<button id = "start" onclick="startRecognition()">Start Recognition</button>
<button id = "end" onclick="stopRecognition()">Stop Recognition</button>
<p id = "output"></p>
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from time import sleep
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
Link = "https://www.naturalreaders.com/online/"
chrome_option = Options()
user_agent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2"
from elevenlabs import set_api_key
from elevenlabs import generate, play
set_api_key('')
def Speak(Text):
Text = str(Text)
audio = generate(
text=Text,
voice="Matilda",
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from time import sleep
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
Link = "https://readloud.net/english/american/29-male-voice-joey.html"
chrome_option = Options()
user_agent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2"
import sounddevice as sd
import numpy as np
threshold = 90
Clap = False
def detect_clap(indata,frames,time,status):
global Clap
volume_norm = np.linalg.norm(indata) * 10
if volume_norm>threshold:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from time import sleep
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
import pathlib
import pyttsx3
import speech_recognition as sr
import warnings