Spaces:
Runtime error
Runtime error
Update inference.py
Browse files- inference.py +4 -3
inference.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import json
|
|
|
|
| 2 |
import httpx
|
| 3 |
|
| 4 |
|
|
@@ -14,10 +15,10 @@ def query(filename, lang):
|
|
| 14 |
|
| 15 |
if (lang == 'ha') and (filename is not None):
|
| 16 |
API_URL = "https://api-inference.huggingface.co/models/Tiamz/hausa-4-ha-wa2vec-data-aug-xls-r-300m"
|
| 17 |
-
with open(filename, "rb") as f:
|
| 18 |
-
data = f.read()
|
| 19 |
try:
|
| 20 |
-
response =
|
| 21 |
command = json.loads(response.content.decode("utf-8"))
|
| 22 |
command = command['text']
|
| 23 |
if command != '':
|
|
|
|
| 1 |
import json
|
| 2 |
+
import requests
|
| 3 |
import httpx
|
| 4 |
|
| 5 |
|
|
|
|
| 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 != '':
|