ndetc_stemmer_space / api_test.py
kaenova's picture
Add api test
5662a67
raw
history blame contribute delete
612 Bytes
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()