Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ from fuzzywuzzy import fuzz
|
|
| 8 |
from data import get_data
|
| 9 |
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
def read_file_and_process(wav_file):
|
| 14 |
filename = wav_file.split('.')[0]
|
|
@@ -34,12 +34,12 @@ def parse_transcription(logits):
|
|
| 34 |
return transcription
|
| 35 |
|
| 36 |
|
| 37 |
-
def parse(wav_file):
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
|
| 45 |
# Function to retrieve an answer based on a question (using fuzzy matching)
|
|
@@ -52,7 +52,7 @@ def get_answer(wav_file):
|
|
| 52 |
highest_score = 0
|
| 53 |
best_answer = None
|
| 54 |
|
| 55 |
-
for item in
|
| 56 |
similarity_score = fuzz.token_set_ratio(user_question, item["question"])
|
| 57 |
if similarity_score > highest_score:
|
| 58 |
highest_score = similarity_score
|
|
|
|
| 8 |
from data import get_data
|
| 9 |
|
| 10 |
|
| 11 |
+
DATASET = get_data()
|
| 12 |
|
| 13 |
def read_file_and_process(wav_file):
|
| 14 |
filename = wav_file.split('.')[0]
|
|
|
|
| 34 |
return transcription
|
| 35 |
|
| 36 |
|
| 37 |
+
# def parse(wav_file):
|
| 38 |
+
# input_values = read_file_and_process(wav_file)
|
| 39 |
+
# with torch.no_grad():
|
| 40 |
+
# logits = model(**input_values).logits
|
| 41 |
+
# user_question = parse_transcription(logits)
|
| 42 |
+
# return user_question
|
| 43 |
|
| 44 |
|
| 45 |
# Function to retrieve an answer based on a question (using fuzzy matching)
|
|
|
|
| 52 |
highest_score = 0
|
| 53 |
best_answer = None
|
| 54 |
|
| 55 |
+
for item in DATASET:
|
| 56 |
similarity_score = fuzz.token_set_ratio(user_question, item["question"])
|
| 57 |
if similarity_score > highest_score:
|
| 58 |
highest_score = similarity_score
|