-
Notifications
You must be signed in to change notification settings - Fork 1
/
getAudio.py
57 lines (41 loc) · 1.67 KB
/
getAudio.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support import ui
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.wait import WebDriverWait
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import Select
import sys
# def document_initialised(driver):
# return driver.execute_script("return initialised")
data_to_pass_back = 'ans'
input = sys.argv[1]
options = webdriver.ChromeOptions()
s = Service('/usr/local/bin/chromedriver')
driver = webdriver.Chrome(service=s, options=options)
url = "https://huggingface.co/spaces/Plachta/VITS-Umamusume-voice-synthesizer"
driver.get(url)
driver.maximize_window()
driver.implicitly_wait(30)
driver.switch_to.frame('iFrameResizer0')
try:
text = driver.find_element(By.CLASS_NAME, 'scroll-hide').clear()
text = driver.find_element(By.CLASS_NAME, 'scroll-hide')
text.send_keys(input)
language = Select(driver.find_element(By.XPATH, '(//select[@class="gr-box gr-input w-full disabled:cursor-not-allowed"])[2]'))
language.select_by_visible_text("English")
generate_button = driver.find_element(By.ID, 'component-24')
generate_button.click()
driver.implicitly_wait(7)
audio = driver.find_element(By.XPATH, '//audio[@class="w-full h-14 p-2 mt-7"]')
audio.click()
audioURL = audio.get_attribute("src")
print(audioURL)
sys.stdout.flush
except:
print('No matching elements found')
while(True):
pass