File size: 519 Bytes
744a4e1
 
 
 
 
 
 
 
 
 
 
 
acb3120
 
744a4e1
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from gradio_client import Client
import gradio as gr
import concurrent.futures

def greet_para(params_text):
    params = params_text.split("\n")
    with concurrent.futures.ThreadPoolExecutor() as executor:
        results = list(executor.map(fetch_api, params))
    return results 
        
def greet(name):
    client = Client("Renecto/queue_10_limit")
    r = client.submit(name="Hello!!",	api_name="/predict")
    return r.result()

demo = gr.Interface(fn=greet_para, inputs="text", outputs="json")
demo.launch()