Spaces:
Runtime error
Runtime error
use cache
Browse files
app.py
CHANGED
|
@@ -16,11 +16,11 @@ headers = {"Authorization": f"Bearer {ACCESS_TOKEN}"}
|
|
| 16 |
|
| 17 |
def query(payload):
|
| 18 |
translation_response = requests.post(TRANSLATION_API_URL, headers=headers, json={
|
| 19 |
-
"inputs": payload, "wait_for_model": True})
|
| 20 |
translation = translation_response.json()[0]['translation_text']
|
| 21 |
|
| 22 |
lang_id_response = requests.post(LANG_ID_API_URL, headers=headers, json={
|
| 23 |
-
"inputs": payload, "wait_for_model": True})
|
| 24 |
lang_id = lang_id_response.json()[0][0]
|
| 25 |
|
| 26 |
return [lang_id, translation]
|
|
|
|
| 16 |
|
| 17 |
def query(payload):
|
| 18 |
translation_response = requests.post(TRANSLATION_API_URL, headers=headers, json={
|
| 19 |
+
"inputs": payload, "wait_for_model": True, "use_cache": True})
|
| 20 |
translation = translation_response.json()[0]['translation_text']
|
| 21 |
|
| 22 |
lang_id_response = requests.post(LANG_ID_API_URL, headers=headers, json={
|
| 23 |
+
"inputs": payload, "wait_for_model": True, "use_cache": True})
|
| 24 |
lang_id = lang_id_response.json()[0][0]
|
| 25 |
|
| 26 |
return [lang_id, translation]
|