Parent / app.py
Renecto's picture
Update app.py
ceeb87c verified
raw
history blame
630 Bytes
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()