mirza-speech 1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mirza_speech-1.0/PKG-INFO +11 -0
- mirza_speech-1.0/mirza_speech/__init__.py +59 -0
- mirza_speech-1.0/mirza_speech.egg-info/PKG-INFO +11 -0
- mirza_speech-1.0/mirza_speech.egg-info/SOURCES.txt +6 -0
- mirza_speech-1.0/mirza_speech.egg-info/dependency_links.txt +1 -0
- mirza_speech-1.0/mirza_speech.egg-info/top_level.txt +1 -0
- mirza_speech-1.0/setup.cfg +4 -0
- mirza_speech-1.0/setup.py +12 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mirza_speech
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: A package for speech to text conversion using selenium and chrome driver
|
|
5
|
+
Author: Mirza
|
|
6
|
+
Author-email: mirzasaquib630@gmail.com
|
|
7
|
+
Project-URL: Homepage, https://speechtotext-rho-six.vercel.app/
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: author-email
|
|
10
|
+
Dynamic: project-url
|
|
11
|
+
Dynamic: summary
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from selenium import webdriver
|
|
2
|
+
from selenium.webdriver.common.by import By
|
|
3
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
4
|
+
from selenium.webdriver.support import expected_conditions as EC
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import time
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
base = Path(__file__).resolve().parent
|
|
10
|
+
|
|
11
|
+
chrome_options = webdriver.ChromeOptions()
|
|
12
|
+
chrome_options.add_argument("--headless=new") # naya headless
|
|
13
|
+
chrome_options.add_argument("--use-fake-ui-for-media-stream")
|
|
14
|
+
#chrome_options.add_argument("--window-size=800,600")
|
|
15
|
+
website = "https://speechtotext-rho-six.vercel.app/"
|
|
16
|
+
driver = webdriver.Chrome(options=chrome_options)
|
|
17
|
+
driver.get(website)
|
|
18
|
+
|
|
19
|
+
rec_file = base / "input.txt"
|
|
20
|
+
|
|
21
|
+
def listen():
|
|
22
|
+
try:
|
|
23
|
+
start_button = WebDriverWait(driver, 10).until(
|
|
24
|
+
EC.element_to_be_clickable((By.ID, "startButton"))
|
|
25
|
+
)
|
|
26
|
+
start_button.click()
|
|
27
|
+
output_element = WebDriverWait(driver, 10).until(
|
|
28
|
+
EC.presence_of_element_located((By.ID, "output"))
|
|
29
|
+
)
|
|
30
|
+
print("Listening... (Ctrl+C to stop)\n")
|
|
31
|
+
|
|
32
|
+
last_id = None
|
|
33
|
+
last_error = None
|
|
34
|
+
while True:
|
|
35
|
+
err = output_element.get_attribute("data-error")
|
|
36
|
+
if err and err != last_error:
|
|
37
|
+
last_error = err
|
|
38
|
+
print(f"\n[Recognition error: {err}]")
|
|
39
|
+
|
|
40
|
+
current = output_element.text.strip()
|
|
41
|
+
uid = output_element.get_attribute("data-id")
|
|
42
|
+
final = output_element.get_attribute("data-final")
|
|
43
|
+
|
|
44
|
+
if current and uid != last_id:
|
|
45
|
+
last_id = uid
|
|
46
|
+
print("\r" + ("USER : " + current).ljust(100), end="", flush=True)
|
|
47
|
+
rec_file.write_text(current.lower(), encoding="utf-8")
|
|
48
|
+
if final == "yes":
|
|
49
|
+
print()
|
|
50
|
+
time.sleep(0.1)
|
|
51
|
+
|
|
52
|
+
except KeyboardInterrupt:
|
|
53
|
+
print("\nStopped.")
|
|
54
|
+
except Exception as e:
|
|
55
|
+
print(str(e).split("Stacktrace")[0])
|
|
56
|
+
finally:
|
|
57
|
+
driver.quit()
|
|
58
|
+
|
|
59
|
+
listen()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mirza_speech
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: A package for speech to text conversion using selenium and chrome driver
|
|
5
|
+
Author: Mirza
|
|
6
|
+
Author-email: mirzasaquib630@gmail.com
|
|
7
|
+
Project-URL: Homepage, https://speechtotext-rho-six.vercel.app/
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: author-email
|
|
10
|
+
Dynamic: project-url
|
|
11
|
+
Dynamic: summary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mirza_speech
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name = "mirza_speech",
|
|
5
|
+
version = "1.0",
|
|
6
|
+
author = "Mirza",
|
|
7
|
+
author_email = "mirzasaquib630@gmail.com",
|
|
8
|
+
description = "A package for speech to text conversion using selenium and chrome driver",
|
|
9
|
+
project_urls = {"Homepage": "https://speechtotext-rho-six.vercel.app/"}
|
|
10
|
+
)
|
|
11
|
+
packages = find_packages(),
|
|
12
|
+
install_requirements = [ "selenium" , "webdriver_manager" , "pathlib" , "time" ]
|