Liusuthu commited on
Commit
51fa915
·
verified ·
1 Parent(s): 0059b6c

Update consult.py

Browse files
Files changed (1) hide show
  1. consult.py +33 -5
consult.py CHANGED
@@ -1,3 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  import os
3
  from consult_func import (
@@ -13,6 +33,8 @@ from consult_func import (
13
  )
14
 
15
  os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
 
 
16
 
17
  # constants
18
  schema = "情感倾向[正向,负向]" # Define the schema for sentence-level sentiment classification
@@ -28,7 +50,7 @@ weight_text2 = 0.6
28
  # scores
29
  score1 = 0 # 第一道问答题:你这段时间真的很不容易,愿意和我说说吗?说什么都可以,也许倾诉出来会好一些呢
30
  score2 = 0 # 第二道问答题:你有什么兴趣爱好吗?平常都喜欢干什么事情呢?愿意和我说说吗?
31
- score3 = 0 # 第三道问答题:
32
 
33
  # video model
34
 
@@ -169,19 +191,25 @@ with gr.Blocks() as consult:
169
  with gr.Column(visible=False) as ans4_1:
170
  text4_1 = gr.Textbox(interactive=True)
171
  btn4_1 = gr.Button("继续")
172
- result4_1 = gr.Textbox(label="结果4_1")
 
173
  # 请把audio4_2换成Audio组件
174
  with gr.Column(visible=False) as ans4_2:
175
  audio4_2 = gr.Audio(
176
  label="语音录制", interactive=True, sources=["microphone"]
177
  ) # 对应out_prob.squeeze(0).numpy()[0]
178
  btn4_2 = gr.Button("继续")
179
- result4_2 = gr.Textbox(label="结果4_2")
 
180
  # 请把video4_3换成Video组件
181
  with gr.Column(visible=False) as ans4_3:
182
- video4_3 = gr.Video(sources=["webcam", "upload"],interactive=True,)
 
 
 
183
  btn4_3 = gr.Button("继续")
184
- result4_3 = gr.Textbox(label="结果4_3")
 
185
 
186
  # 针对无价值感、无意义感、无力感
187
 
 
1
+ import numpy as np
2
+ import soundfile as sf
3
+ import torchaudio
4
+ from speechbrain.pretrained.interfaces import foreign_class
5
+
6
+ from app_utils import video_score,video_test
7
+ from authors import AUTHORS
8
+
9
+ # Importing necessary components for the Gradio app
10
+ from description import DESCRIPTION_DYNAMIC # , DESCRIPTION_STATIC
11
+
12
+ # import scipy.io.wavfile as wav
13
+ from paraformer import AudioReader, CttPunctuator, FSMNVad, ParaformerOffline
14
+
15
+ from gradio_client import Client
16
+
17
+
18
+
19
+
20
+
21
  import gradio as gr
22
  import os
23
  from consult_func import (
 
33
  )
34
 
35
  os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
36
+ client = Client("Liusuthu/TextDepression")
37
+
38
 
39
  # constants
40
  schema = "情感倾向[正向,负向]" # Define the schema for sentence-level sentiment classification
 
50
  # scores
51
  score1 = 0 # 第一道问答题:你这段时间真的很不容易,愿意和我说说吗?说什么都可以,也许倾诉出来会好一些呢
52
  score2 = 0 # 第二道问答题:你有什么兴趣爱好吗?平常都喜欢干什么事情呢?愿意和我说说吗?
53
+ score3 = 0 # 第三道问答题:最近状态
54
 
55
  # video model
56
 
 
191
  with gr.Column(visible=False) as ans4_1:
192
  text4_1 = gr.Textbox(interactive=True)
193
  btn4_1 = gr.Button("继续")
194
+ result4_11 = gr.Textbox(label="语音结果4_1")
195
+ result4_12 = gr.Textbox(label="分数结果4_1")
196
  # 请把audio4_2换成Audio组件
197
  with gr.Column(visible=False) as ans4_2:
198
  audio4_2 = gr.Audio(
199
  label="语音录制", interactive=True, sources=["microphone"]
200
  ) # 对应out_prob.squeeze(0).numpy()[0]
201
  btn4_2 = gr.Button("继续")
202
+ result4_21 = gr.Textbox(label="结果4_2")
203
+ result4_22 = gr.Textbox(label="分数结果4_2")
204
  # 请把video4_3换成Video组件
205
  with gr.Column(visible=False) as ans4_3:
206
+ video4_3 = gr.Video(
207
+ sources=["webcam", "upload"],
208
+ interactive=True,
209
+ )
210
  btn4_3 = gr.Button("继续")
211
+ result4_31 = gr.Textbox(label="结果4_3")
212
+ result4_32 = gr.Textbox(label="分数结果4_3")
213
 
214
  # 针对无价值感、无意义感、无力感
215