Created
January 3, 2024 13:51
-
-
Save KaushikShresth07/b775c771911f4883b5dbad49345ff658 to your computer and use it in GitHub Desktop.
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 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" | |
chrome_option.add_argument(f"user-agent={user_agent}") | |
chrome_option.add_argument("--headless=new") | |
service = Service(ChromeDriverManager().install()) | |
driver = webdriver.Chrome(service=service,options=chrome_option) | |
driver.maximize_window() | |
driver.get(url=Link) | |
def WaitForTheWebsiteToLoad(): | |
sleep(2) | |
while True: | |
try: | |
driver.find_element(by=By.XPATH,value='//*[@id="dle-content"]/article/div[2]/center/div/form/textarea') | |
break | |
except: | |
pass | |
def TextToSpeech(Text): | |
try: | |
driver.find_element(by=By.XPATH,value='//*[@id="dle-content"]/article/div[2]/center/div/form/textarea').send_keys(Text) | |
except: | |
pass | |
sleep(0.5) | |
try: | |
driver.find_element(by=By.XPATH,value='//*[@id="dle-content"]/article/div[2]/center/div/form/span/input').click() | |
except: | |
pass | |
sleep(0.5) | |
try: | |
driver.find_element(by=By.XPATH,value='//*[@id="dle-content"]/article/div[2]/center/div/form/textarea').clear() | |
except: | |
pass | |
WaitForTheWebsiteToLoad() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from gradio_client import Client
message = "hello ther AI who are you im sharry"
client = Client("https://huggingface-projects-llama-2-13b-chat.hf.space/--replicas/686pt/")
result = client.predict(
message,
"hello", # str in 'Message' Textbox component # str in 'System prompt' Textbox component
2048, # int | float (numeric value between 1 and 2048) in 'Max new tokens' Slider component
0.1, # int | float (numeric value between 0.1 and 4.0) in 'Temperature' Slider component
0.05, # int | float (numeric value between 0.05 and 1.0) in 'Top-p (nucleus sampling)' Slider component
1, # int | float (numeric value between 1 and 1000) in 'Top-k' Slider component
1, # int | float (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
api_name="/chat"
)
print(result)