Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from gradio_client import Client
|
2 |
+
import gradio as gr
|
3 |
+
import concurrent.futures
|
4 |
+
|
5 |
+
def greet_para(params_text):
|
6 |
+
params = params_text.split("\n")
|
7 |
+
with concurrent.futures.ThreadPoolExecutor() as executor:
|
8 |
+
results = list(executor.map(fetch_api, params))
|
9 |
+
return results
|
10 |
+
|
11 |
+
def greet(name):
|
12 |
+
client = Client("Renecto/queue_10_limit")
|
13 |
+
result = client.predict(name="Hello!!", api_name="/predict")
|
14 |
+
print(result)
|
15 |
+
|
16 |
+
demo = gr.Interface(fn=greet_para, inputs="text", outputs="json")
|
17 |
+
demo.launch()
|
18 |
+
|