Spaces:
Build error
Build error
Kartikeyssj2
commited on
Commit
·
c14d52f
1
Parent(s):
7365efc
changes
Browse files- download_vocabulary.py +12 -0
- main.py +1 -1
download_vocabulary.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
|
4 |
+
def download_word_list():
|
5 |
+
print("Downloading English word list...")
|
6 |
+
url = "https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt"
|
7 |
+
response = requests.get(url)
|
8 |
+
words = set(response.text.split())
|
9 |
+
print("Word list downloaded.")
|
10 |
+
return words
|
11 |
+
|
12 |
+
english_words = download_word_list()
|
main.py
CHANGED
@@ -18,7 +18,6 @@ app = FastAPI()
|
|
18 |
# Load Wav2Vec2 tokenizer and model
|
19 |
tokenizer = Wav2Vec2Tokenizer.from_pretrained("./models/tokenizer")
|
20 |
model = Wav2Vec2ForCTC.from_pretrained("./models/model")
|
21 |
-
english_words = download_word_list()
|
22 |
|
23 |
|
24 |
# Function to download English word list
|
@@ -30,6 +29,7 @@ def download_word_list():
|
|
30 |
print("Word list downloaded.")
|
31 |
return words
|
32 |
|
|
|
33 |
|
34 |
# Function to count correctly spelled words in text
|
35 |
def count_spelled_words(text, word_list):
|
|
|
18 |
# Load Wav2Vec2 tokenizer and model
|
19 |
tokenizer = Wav2Vec2Tokenizer.from_pretrained("./models/tokenizer")
|
20 |
model = Wav2Vec2ForCTC.from_pretrained("./models/model")
|
|
|
21 |
|
22 |
|
23 |
# Function to download English word list
|
|
|
29 |
print("Word list downloaded.")
|
30 |
return words
|
31 |
|
32 |
+
english_words = download_word_list()
|
33 |
|
34 |
# Function to count correctly spelled words in text
|
35 |
def count_spelled_words(text, word_list):
|