File size: 628 Bytes
a48216a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import json
import requests
import time


def json_send(data, url):
    headers = {"Content-type": "application/json",
               "Accept": "text/plain", "charset": "UTF-8"}
    response = requests.post(url=url, headers=headers, data=json.dumps(data))
    return json.loads(response.text)


if __name__ == "__main__":
    url = 'http://127.0.0.1:9099/check_hunyin'

    print("Start inference")

    while True:
        input_text = input("Enter text:").strip()
        if len(input_text) == 0:
            continue
        data = {"input": input_text}
        result = json_send(data, url)
        print(result['output'])