Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio_client import Client
|
| 3 |
-
|
|
|
|
| 4 |
client = Client("wasmdashai/wasm-spad",download_files=False)
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
result = client.submit(
|
| 7 |
text=text,
|
| 8 |
api_name="/text_to_speech",
|
|
@@ -10,9 +15,9 @@ def streamwav(text):
|
|
| 10 |
)
|
| 11 |
for chk in result:
|
| 12 |
#print(chk)
|
| 13 |
-
return chk['url']
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
-
demo = gr.Interface(fn=streamwav, inputs="text", outputs="text")
|
| 18 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio_client import Client
|
| 3 |
+
|
| 4 |
+
def create_session():
|
| 5 |
client = Client("wasmdashai/wasm-spad",download_files=False)
|
| 6 |
+
return client
|
| 7 |
|
| 8 |
+
def streamwav(text,client):
|
| 9 |
+
if client is None:
|
| 10 |
+
client=create_session()
|
| 11 |
result = client.submit(
|
| 12 |
text=text,
|
| 13 |
api_name="/text_to_speech",
|
|
|
|
| 15 |
)
|
| 16 |
for chk in result:
|
| 17 |
#print(chk)
|
| 18 |
+
return chk['url'],client
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
+
demo = gr.Interface(fn=streamwav, inputs=["text","state"], outputs=["text","state"])
|
| 23 |
demo.launch()
|