Liusuthu commited on
Commit
cf72411
Β·
verified Β·
1 Parent(s): de1a106

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -3
app.py CHANGED
@@ -258,7 +258,7 @@ def clear_2():
258
  with gr.Blocks() as speech_all:
259
  with gr.Row():
260
  with gr.Column(scale=2):
261
- input_audio=gr.Audio()
262
  with gr.Row():
263
  clear_audio = gr.Button(
264
  value="Clear", interactive=True, scale=1
@@ -279,9 +279,31 @@ with gr.Blocks() as speech_all:
279
  inputs=[input_audio],
280
  outputs=[score2,text_emo],
281
  )
 
282
 
283
-
 
 
 
 
284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  with gr.Blocks() as app:
286
  with gr.Tab("语音"):
287
  speech.render()
@@ -291,6 +313,7 @@ with gr.Blocks() as app:
291
  video_all.render()
292
  with gr.Tab("θ―­ιŸ³ι›†ζˆζ‰“εˆ†"):
293
  speech_all.render()
294
-
 
295
 
296
  app.launch()
 
258
  with gr.Blocks() as speech_all:
259
  with gr.Row():
260
  with gr.Column(scale=2):
261
+ input_audio=gr.Audio(source="microphone")
262
  with gr.Row():
263
  clear_audio = gr.Button(
264
  value="Clear", interactive=True, scale=1
 
279
  inputs=[input_audio],
280
  outputs=[score2,text_emo],
281
  )
282
+ ###################################################################
283
 
284
+ def clear_3():
285
+ return gr.Textbox(""),gr.Textbox("")
286
+ def text_score(text):
287
+ result=text_api(text)
288
+ return result
289
 
290
+ with gr.Blocks(css=css) as text_all:
291
+ with gr.Row():
292
+ with gr.Column(scale=2):
293
+ input_text=gr.Textbox(label="input")
294
+ with gr.Row():
295
+ clear_text = gr.Button(
296
+ value="Clear", interactive=True, scale=1
297
+ )
298
+ submit_text = gr.Button(
299
+ value="Score", interactive=True, scale=1, elem_classes="submit"
300
+ )
301
+ with gr.Column(scale=2):
302
+ text_emo=gr.Textbox(label="text_emo")
303
+
304
+ clear_text.click(clear3,outputs=[input_text,text_emo])
305
+ submit_text.click(text_score,inputs=input_text,outputs=text_emo)
306
+
307
  with gr.Blocks() as app:
308
  with gr.Tab("语音"):
309
  speech.render()
 
313
  video_all.render()
314
  with gr.Tab("θ―­ιŸ³ι›†ζˆζ‰“εˆ†"):
315
  speech_all.render()
316
+ with gr.Tab("ζ–‡ζœ¬ζ‰“εˆ†"):
317
+ text_all.render()
318
 
319
  app.launch()