netHighTech-STT 1.0.8__tar.gz → 1.0.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: netHighTech_STT
3
- Version: 1.0.8
3
+ Version: 1.0.9
4
4
  Summary: Speech recognition Jarvis package
5
5
  Author: Zubair Khan
6
6
  Author-email: zubairdev00@gmail.com
@@ -0,0 +1,74 @@
1
+ import time
2
+ import os
3
+ from selenium import webdriver
4
+ from selenium.webdriver.common.by import By
5
+ from selenium.webdriver.chrome.service import Service
6
+ from webdriver_manager.chrome import ChromeDriverManager
7
+
8
+ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
9
+
10
+ def listen():
11
+ chrome_options = webdriver.ChromeOptions()
12
+ chrome_options.add_argument("--use-fake-ui-for-media-stream")
13
+ # ❌ HEADLESS OFF
14
+ # chrome_options.add_argument("--headless=new")
15
+
16
+ driver = webdriver.Chrome(
17
+ service=Service(ChromeDriverManager().install()),
18
+ options=chrome_options
19
+ )
20
+
21
+ html_path = f"file:///{os.path.join(BASE_DIR, 'index.html')}"
22
+ driver.get(html_path)
23
+
24
+ driver.find_element(By.ID, 'start-btn').click()
25
+ print("🎤 Jarvis is Listening...")
26
+
27
+ while True:
28
+ output = driver.find_element(By.ID, 'result').text.strip()
29
+
30
+ if len(output) > 1:
31
+ print("Heard:", output)
32
+ driver.execute_script(
33
+ "document.getElementById('result').textContent = '';"
34
+ )
35
+ return output # 🔥🔥 MOST IMPORTANT LINE 🔥🔥
36
+
37
+ time.sleep(0.3)
38
+ import time
39
+ import os
40
+ from selenium import webdriver
41
+ from selenium.webdriver.common.by import By
42
+ from selenium.webdriver.chrome.service import Service
43
+ from webdriver_manager.chrome import ChromeDriverManager
44
+
45
+ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
46
+
47
+ def listen():
48
+ chrome_options = webdriver.ChromeOptions()
49
+ chrome_options.add_argument("--use-fake-ui-for-media-stream")
50
+ # ❌ HEADLESS OFF
51
+ chrome_options.add_argument("--headless=new")
52
+
53
+ driver = webdriver.Chrome(
54
+ service=Service(ChromeDriverManager().install()),
55
+ options=chrome_options
56
+ )
57
+
58
+ html_path = f"file:///{os.path.join(BASE_DIR, 'index.html')}"
59
+ driver.get(html_path)
60
+
61
+ driver.find_element(By.ID, 'start-btn').click()
62
+ print("🎤 Jarvis is Listening...")
63
+
64
+ while True:
65
+ output = driver.find_element(By.ID, 'result').text.strip()
66
+
67
+ if len(output) > 1:
68
+ print("Heard:", output)
69
+ driver.execute_script(
70
+ "document.getElementById('result').textContent = '';"
71
+ )
72
+ return output # 🔥🔥 MOST IMPORTANT LINE 🔥🔥
73
+
74
+ time.sleep(0.3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: netHighTech_STT
3
- Version: 1.0.8
3
+ Version: 1.0.9
4
4
  Summary: Speech recognition Jarvis package
5
5
  Author: Zubair Khan
6
6
  Author-email: zubairdev00@gmail.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='netHighTech_STT', # Naya package naam
5
- version='1.0.8', # Naya version number
5
+ version='1.0.9', # Naya version number
6
6
  author='Zubair Khan',
7
7
  author_email='zubairdev00@gmail.com',
8
8
  description='Speech recognition Jarvis package',
@@ -1,39 +0,0 @@
1
- import time
2
- import os
3
- from selenium import webdriver
4
- from selenium.webdriver.common.by import By
5
- from selenium.webdriver.chrome.service import Service
6
- from webdriver_manager.chrome import ChromeDriverManager
7
-
8
- # Dynamic Path nikalne ke liye
9
- BASE_DIR = os.path.dirname(os.path.abspath(__file__))
10
-
11
- def listen():
12
- chrome_options = webdriver.ChromeOptions()
13
- chrome_options.add_argument("--use-fake-ui-for-media-stream")
14
- # Shuru mein headless OFF rakho taake error dikhay
15
- chrome_options.add_argument("--headless=new")
16
-
17
- driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
18
-
19
- # Path ko join karne ka sahi tarika
20
- html_path = f"file:///{os.path.join(BASE_DIR, 'index.html')}"
21
- input_path = os.path.join(BASE_DIR, "input.txt")
22
-
23
- driver.get(html_path)
24
-
25
- try:
26
- # Start button click
27
- driver.find_element(By.ID, 'start-btn').click()
28
- print("Jarvis is Listening...")
29
-
30
- while True:
31
- output = driver.find_element(By.ID, 'result').text.strip()
32
- if len(output) > 1:
33
- with open(input_path, 'w', encoding='utf-8') as f:
34
- f.write(output)
35
- print("Heard:", output)
36
- driver.execute_script("document.getElementById('result').textContent = '';")
37
- time.sleep(0.5)
38
- except Exception as e:
39
- print(f"Error: {e}")