19 lines
359 B
Python
19 lines
359 B
Python
#!/usr/bin/pyhton3
|
|
import requests
|
|
|
|
|
|
def translate(_input, lang='ru'):
|
|
url = "http://192.168.8.3:5000/translate"
|
|
|
|
r = requests.post(
|
|
url,
|
|
json={
|
|
"q": _input,
|
|
"source": "en",
|
|
"target": lang,
|
|
},
|
|
headers={"Content-Type": "application/json"}
|
|
|
|
)
|
|
return r.json()['translatedText']
|