kongdeqiang
2026-03-13 28ccfbfc51068a663a80764e14074df5edf2b5ba
runtime/python/onnxruntime/funasr_client_http.py
@@ -3,16 +3,25 @@
import threading
with open('A2_0.wav','rb') as f:
    test_wav_bytes=f.read()
url='http://127.0.0.1:8888/api/asr'
def send_post(i,url,wav_bytes):
    r1=requests.post(url,json={'wav_base64':str(base64.b64encode(wav_bytes), 'utf-8')})
    print('线程:',i,r1.json())
with open("A2_0.wav", "rb") as f:
    test_wav_bytes = f.read()
url = "http://127.0.0.1:8888/api/asr"
def send_post(i, url, wav_bytes):
    r1 = requests.post(url, json={"wav_base64": str(base64.b64encode(wav_bytes), "utf-8")})
    print("线程:", i, r1.json())
for i in range(100):
    t = threading.Thread(target=send_post, args=(i,url,test_wav_bytes,))
    t = threading.Thread(
        target=send_post,
        args=(
            i,
            url,
            test_wav_bytes,
        ),
    )
    t.start()
    #t.join()
print('完成测试')
    # t.join()
print("完成测试")