You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# https://huggingface.co/spaces/Geonmo/nllb-translation-demoimportrequestsimporttimedefPostData(url, json_data):
resp=requests.post(url,json=json_data)
resp_json=resp.json()
returnresp_jsontext='''By default, OpenTracing doesn't log automatically into span logs, only important messages that Jaeger feels it needs to be logged and is needed for tracing would be there :). The idea is to separate responsibilities between Tracing and Log management, Check this GitHub discussion.An alternative would be to use centralized log management and print traceId & spanId into your logs for troubleshooting and correlating logs and tracing.'''request_json= {"fn_index":0,"data":["English","Chinese (Simplified)",text],"action":"predict","session_hash":"un6x6o8iojq"}
resp=requests.post('https://geonmo-nllb-translation-demo.hf.space/api/queue/push/',json=request_json)
resp_json=resp.json()
hash=resp_json['hash']
print(resp_json)
whileTrue:
url='https://geonmo-nllb-translation-demo.hf.space/api/queue/status/'request_json= {"hash":hash}
resp_json=requests.post(url,json=request_json).json()
# {"status":"COMPLETE","data":{"data":[{"inference_time":0.7774190902709961,"source":"eng_Latn","target":"zho_Hans","result":"你好世界"}],"duration":0.7777302265167236,"average_duration":3.264024568158527}}print (resp_json)
ifresp_json['status']=='COMPLETE':
breaktime.sleep(1)
测了一下。效果一般般。感觉比google翻译差
Output
The text was updated successfully, but these errors were encountered: