Hunzla commited on
Commit
c2d790b
1 Parent(s): c9eb3de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -33,6 +33,7 @@ def find_most_similar_command(statement, command_list):
33
 
34
  return best_match,reply
35
  def transcribe_the_command(audio,id):
 
36
  import soundfile as sf
37
  commands=urdu_data[id]
38
  print(commands)
@@ -43,10 +44,13 @@ def transcribe_the_command(audio,id):
43
  print(file_name)
44
 
45
  transcript = asr_pipe(file_name)["text"]
46
- most_similar_command,reply = find_most_similar_command(transcript, commands)
47
- print(f"Given Statement: {transcript}")
48
- print(f"Most Similar Command: {most_similar_command}\n")
49
- print(reply)
 
 
 
50
 
51
  return reply
52
  # get_text_from_voice("urdu.wav")
 
33
 
34
  return best_match,reply
35
  def transcribe_the_command(audio,id):
36
+
37
  import soundfile as sf
38
  commands=urdu_data[id]
39
  print(commands)
 
44
  print(file_name)
45
 
46
  transcript = asr_pipe(file_name)["text"]
47
+ if id == "transcript_only":
48
+ reply=transcript
49
+ else:
50
+ most_similar_command,reply = find_most_similar_command(transcript, commands)
51
+ print(f"Given Statement: {transcript}")
52
+ print(f"Most Similar Command: {most_similar_command}\n")
53
+ print(reply)
54
 
55
  return reply
56
  # get_text_from_voice("urdu.wav")