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