Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,9 @@ from description import DESCRIPTION_DYNAMIC # , DESCRIPTION_STATIC
|
|
15 |
# import scipy.io.wavfile as wav
|
16 |
from paraformer import AudioReader, CttPunctuator, FSMNVad, ParaformerOffline
|
17 |
|
|
|
|
|
|
|
18 |
os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
|
19 |
###########################θ―ι³ι¨ε######################################
|
20 |
classifier = foreign_class(
|
@@ -27,6 +30,13 @@ ASR_model = ParaformerOffline()
|
|
27 |
vad = FSMNVad()
|
28 |
punc = CttPunctuator()
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
def classify_continuous(audio):
|
32 |
print(type(audio))
|
@@ -96,6 +106,8 @@ with gr.Blocks(css="app.css") as video:
|
|
96 |
out1=gr.Textbox(label="θ―ι³εζη»ζ")
|
97 |
out2=gr.Textbox(label="ι³ι’ζ
ζθ―ε«1")
|
98 |
out3=gr.Textbox(label="ι³ι’ζ
ζθ―ε«2")
|
|
|
|
|
99 |
gr.Examples(
|
100 |
[
|
101 |
"videos/video1.mp4",
|
@@ -133,7 +145,11 @@ with gr.Blocks(css="app.css") as video:
|
|
133 |
inputs=output_audio,
|
134 |
outputs=[out1,out2,out3]
|
135 |
)
|
136 |
-
|
|
|
|
|
|
|
|
|
137 |
####################################
|
138 |
speech = gr.Interface(
|
139 |
classify_continuous,
|
|
|
15 |
# import scipy.io.wavfile as wav
|
16 |
from paraformer import AudioReader, CttPunctuator, FSMNVad, ParaformerOffline
|
17 |
|
18 |
+
from gradio_client import Client
|
19 |
+
client = Client("Liusuthu/TextDepression")
|
20 |
+
|
21 |
os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
|
22 |
###########################θ―ι³ι¨ε######################################
|
23 |
classifier = foreign_class(
|
|
|
30 |
vad = FSMNVad()
|
31 |
punc = CttPunctuator()
|
32 |
|
33 |
+
def text_api(text:str):
|
34 |
+
result = client.predict(
|
35 |
+
sentence, # str in 'θΎε
₯ζε' Textbox component
|
36 |
+
api_name="/predict",
|
37 |
+
)
|
38 |
+
return result
|
39 |
+
|
40 |
|
41 |
def classify_continuous(audio):
|
42 |
print(type(audio))
|
|
|
106 |
out1=gr.Textbox(label="θ―ι³εζη»ζ")
|
107 |
out2=gr.Textbox(label="ι³ι’ζ
ζθ―ε«1")
|
108 |
out3=gr.Textbox(label="ι³ι’ζ
ζθ―ε«2")
|
109 |
+
text_test_button=gr.Button("εζζζ¬")
|
110 |
+
text_result=gr.Textbox(interactive=False)
|
111 |
gr.Examples(
|
112 |
[
|
113 |
"videos/video1.mp4",
|
|
|
145 |
inputs=output_audio,
|
146 |
outputs=[out1,out2,out3]
|
147 |
)
|
148 |
+
text_test_button.click(
|
149 |
+
fn=text_api,
|
150 |
+
inputs=out1,
|
151 |
+
outputs=text_result,
|
152 |
+
)
|
153 |
####################################
|
154 |
speech = gr.Interface(
|
155 |
classify_continuous,
|