游雁
2024-06-13 d72df6cd2f1914a749db0778233f3a66f447894a
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
27
import base64
import requests
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())
 
 
for i in range(100):
    t = threading.Thread(
        target=send_post,
        args=(
            i,
            url,
            test_wav_bytes,
        ),
    )
    t.start()
    # t.join()
print("完成测试")