luciusssss's picture
Upload 22 files
a48216a verified
raw
history blame contribute delete
628 Bytes
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'])