Hunzla commited on
Commit
f76fdb7
1 Parent(s): c3e3452

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -24,11 +24,14 @@ with open("tasks.json", "r",encoding="utf-8") as json_file:
24
  def find_most_similar_command(statement, command_list):
25
  best_match = None
26
  highest_similarity = 0
27
- i=0
 
 
28
  for index,file_list in command_list.items():
29
- "sum_match_"+str(i)=0
30
  for command in file_list:
31
  similarity = SequenceMatcher(None, statement, command).ratio()
 
32
  "sum_match_"+str(i)="sum_match_"+str(i)+similarity
33
  print("sum_match_"+str(i))
34
  print(index,"similarity",similarity)
@@ -36,7 +39,10 @@ def find_most_similar_command(statement, command_list):
36
  highest_similarity = similarity
37
  best_match = command
38
  reply=index
39
- return best_match,reply
 
 
 
40
 
41
  def transcribe_the_command(audio,menu_id,abc):
42
  import soundfile as sf
 
24
  def find_most_similar_command(statement, command_list):
25
  best_match = None
26
  highest_similarity = 0
27
+ i = 0 # Replace this with your value of i
28
+
29
+ # Using globals() to create a global variable
30
  for index,file_list in command_list.items():
31
+ globals()[f"sum_{i}"] = 0
32
  for command in file_list:
33
  similarity = SequenceMatcher(None, statement, command).ratio()
34
+ f"sum_{i}"= f"sum_{i}"+similarity
35
  "sum_match_"+str(i)="sum_match_"+str(i)+similarity
36
  print("sum_match_"+str(i))
37
  print(index,"similarity",similarity)
 
39
  highest_similarity = similarity
40
  best_match = command
41
  reply=index
42
+ print(i)
43
+ print(f"sum_{i}")
44
+ i=i+1
45
+ return best_match,reply
46
 
47
  def transcribe_the_command(audio,menu_id,abc):
48
  import soundfile as sf