File size: 612 Bytes
12d271a
 
 
5662a67
 
 
 
12d271a
5662a67
 
12d271a
 
 
5662a67
12d271a
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
from gradio_client import Client
import threading

from faker import Faker
Faker.seed(0)
fake = Faker('id_ID')


client = Client("https://kaenova-ndetc-stemmer-space.hf.space/")
num_requests = 1000

def request(workers_num: "int"):
    client.predict(
        fake.paragraph(),  # str representing string value in 'Input Text' Textbox component
        api_name="/process",
    )
    print(workers_num)


threads: threading.Thread = []

for i in range(num_requests):
    thread = threading.Thread(target=request, args=(i,))
    threads.append(thread)
    thread.start()

for thread in threads:
    thread.join()