Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,11 @@ import gradio as gr
|
|
5 |
import sox
|
6 |
import subprocess
|
7 |
from fuzzywuzzy import fuzz
|
8 |
-
from data import
|
9 |
|
10 |
|
|
|
|
|
11 |
def read_file_and_process(wav_file):
|
12 |
filename = wav_file.split('.')[0]
|
13 |
filename_16k = filename + "16k.wav"
|
@@ -41,7 +43,12 @@ def parse(wav_file):
|
|
41 |
|
42 |
|
43 |
# Function to retrieve an answer based on a question (using fuzzy matching)
|
44 |
-
def get_answer(
|
|
|
|
|
|
|
|
|
|
|
45 |
highest_score = 0
|
46 |
best_answer = None
|
47 |
|
|
|
5 |
import sox
|
6 |
import subprocess
|
7 |
from fuzzywuzzy import fuzz
|
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]
|
15 |
filename_16k = filename + "16k.wav"
|
|
|
43 |
|
44 |
|
45 |
# Function to retrieve an answer based on a question (using fuzzy matching)
|
46 |
+
def get_answer(wav_file):
|
47 |
+
input_values = read_file_and_process(wav_file)
|
48 |
+
with torch.no_grad():
|
49 |
+
logits = model(**input_values).logits
|
50 |
+
user_question = parse_transcription(logits)
|
51 |
+
|
52 |
highest_score = 0
|
53 |
best_answer = None
|
54 |
|