Hi,
I have the following client code which gets response from server at port 7790.
CLIENT CODE:
import requests
def translate_de_en():
** url = “http://0.0.0.0:7790/translator/translate”**
** ans = ‘y’**
** while ans is ‘y’ :**
** source = input("Enter the sentence ==> ")**
** if not source:**
** #print("")**
** return “”**
** headers = {‘content-type’:‘application/json’}**
** params = [{“src”:source, “id”:1}]**
** response = requests.post(url, json=params, headers=headers)**
** target = response.json()**
** print(target)**
** #print(target[0][0][“tgt”])**
** print(response)**
** ans = input(“Do you want to continue: y or n ?”)**
if name == “main”:
** translate_de_en()**
The following is the response from the server:
**administrator@:~/OpenNMT$ python3 translate_de_en.py **
Enter the sentence ==> hallo welt
{‘error’: “Error: ‘TextMultiField’ object has no attribute ‘is_target’”, ‘status’: ‘error’}
<Response [200]>
Do you want to continue: y or n ?
I had done the following to upgrade Pytorch/torchtext
(ref : How to get response from the running Server.py at port 7790)
sudo python3 -m pip install --upgrade git+https://github.com/pytorch/text
initially the issue got resolved. But after every reboot, the issue started appearing again.Now the issue persists.
Could someone please give a permanent solution to this.
Than You,
Kishor.