File size: 630 Bytes
2842ee5 35f26fa 2842ee5 35f26fa e9d8da6 35f26fa 2842ee5 35f26fa ceeb87c 2842ee5 |
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 |
import gradio as gr
import time
from gradio_client import Client
import concurrent.futures
def grand_para(num):
client = Client("Renecto/child")
result = client.submit(
params_text=f"""aaa{num}
bbb{num}
ccc{num}
ddd{num}
eee{num}
fff{num}""",
api_name="/predict"
)
return result.result()
def greet(num):
params = []
for i in range(0,num):
params.append(i)
with concurrent.futures.ThreadPoolExecutor() as executor:
results = list(executor.map(grand_para, params))
return results
demo = gr.Interface(fn=greet, inputs=gr.Number(3), outputs="json", concurrency_limit=5)
demo.launch() |