Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from transformers import pipeline
|
|
|
2 |
transcript_pipe = pipeline("automatic-speech-recognition", model="ihanif/whisper-medium-urdu")
|
3 |
from difflib import SequenceMatcher
|
4 |
import json
|
@@ -32,7 +33,10 @@ def find_most_similar_command(statement, command_list):
|
|
32 |
highest_similarity = similarity
|
33 |
best_match = command
|
34 |
reply=index
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
def transcribe_the_command(audio,menu_id,abc):
|
38 |
import soundfile as sf
|
|
|
1 |
from transformers import pipeline
|
2 |
+
asr_pipe = pipeline("automatic-speech-recognition", model="Abdullah17/whisper-small-urdu")
|
3 |
transcript_pipe = pipeline("automatic-speech-recognition", model="ihanif/whisper-medium-urdu")
|
4 |
from difflib import SequenceMatcher
|
5 |
import json
|
|
|
33 |
highest_similarity = similarity
|
34 |
best_match = command
|
35 |
reply=index
|
36 |
+
if highest_similarity > 0.7:
|
37 |
+
return best_match,reply
|
38 |
+
else:
|
39 |
+
return "repeat_command",404
|
40 |
|
41 |
def transcribe_the_command(audio,menu_id,abc):
|
42 |
import soundfile as sf
|