SamSwift commited on
Commit
8413b4b
·
1 Parent(s): 0f7067d

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +6 -6
inference.py CHANGED
@@ -15,10 +15,10 @@ def query(filename, lang):
15
 
16
  if (lang == 'ha') and (filename is not None):
17
  API_URL = "https://api-inference.huggingface.co/models/Tiamz/hausa-4-ha-wa2vec-data-aug-xls-r-300m"
18
- #with open(filename, "rb") as f:
19
- #data = f.read()
20
  try:
21
- response = requests.request("POST", API_URL, headers=headers, data=filename)
22
  command = json.loads(response.content.decode("utf-8"))
23
  command = command['text']
24
  if command != '':
@@ -32,11 +32,11 @@ def query(filename, lang):
32
 
33
  elif (lang == 'yo') and (filename is not None):
34
  API_URL = "https://api-inference.huggingface.co/models/Ayoola/cdial-yoruba-test"
35
- #with open(filename, "rb") as f:
36
- #data = f.read()
37
 
38
  try:
39
- response = requests.request("POST", API_URL, headers=headers, data=filename)
40
  command = json.loads(response.content.decode("utf-8"))
41
  command = command['text']
42
  if command != '':
 
15
 
16
  if (lang == 'ha') and (filename is not None):
17
  API_URL = "https://api-inference.huggingface.co/models/Tiamz/hausa-4-ha-wa2vec-data-aug-xls-r-300m"
18
+ with open(filename, "rb") as f:
19
+ data = f.read()
20
  try:
21
+ response = requests.request("POST", API_URL, headers=headers, data=data)
22
  command = json.loads(response.content.decode("utf-8"))
23
  command = command['text']
24
  if command != '':
 
32
 
33
  elif (lang == 'yo') and (filename is not None):
34
  API_URL = "https://api-inference.huggingface.co/models/Ayoola/cdial-yoruba-test"
35
+ with open(filename, "rb") as f:
36
+ data = f.read()
37
 
38
  try:
39
+ response = requests.request("POST", API_URL, headers=headers, data=data)
40
  command = json.loads(response.content.decode("utf-8"))
41
  command = command['text']
42
  if command != '':