Liusuthu commited on
Commit
8736016
·
verified ·
1 Parent(s): 10eadb4

Update consult_func.py

Browse files
Files changed (1) hide show
  1. consult_func.py +17 -7
consult_func.py CHANGED
@@ -158,6 +158,12 @@ def advice4(radio5, text3_1, radio8, radio9, radio10):
158
  return ""
159
 
160
 
 
 
 
 
 
 
161
  def advice(
162
  radio1, radio2, radio3, radio4, radio5, radio6, text3_1, radio8, radio9, radio10,result1,result2,result3
163
  ):
@@ -172,7 +178,9 @@ def advice(
172
  final_score=(((-1+result2+result3)/3)+1)*50
173
  else:
174
  final_score=(((0.5+result1+result2+result3)/3)+1)*50
 
175
 
 
176
  SLEEP = advice1(radio1, radio2, radio3)
177
  EAT = advice2(radio4)
178
  MOOD = advice3(radio5, radio6)
@@ -186,20 +194,22 @@ def advice(
186
 
187
  FINAL_ADVICE = """
188
  <h1 style='text-align:center;'>检测报告</h1>
 
 
189
  <h3 style='text-align:center;'>睡眠状况</h3>
190
- &emsp;&emsp;{0}\n
191
- <h3 style='text-align:center;'>饮食状况</h3>
192
  &emsp;&emsp;{1}\n
193
- <h3 style='text-align:center;'>情绪状况</h3>
194
  &emsp;&emsp;{2}\n
 
195
  &emsp;&emsp;{3}\n
196
- <h3 style='text-align:center;'>兴趣爱好</h3>
197
  &emsp;&emsp;{4}\n
198
- <h3 style='text-align:center;'>近期情况</h3>
199
  &emsp;&emsp;{5}\n
200
- <h3 style='text-align:center;'>结语</h3>
201
  &emsp;&emsp;{6}\n
202
- """.format(SLEEP, EAT, MOOD, SUICIDE, INTEREST, RECENT, SUMMARY)
 
 
203
 
204
  return (
205
  gr.Column(visible=True),
 
158
  return ""
159
 
160
 
161
+ def score_analysis(score):
162
+ if score>=50:
163
+ return "你的分数高于50,这意味着你的负面情绪占比较高,你可能有轻微的抑郁倾向,这可能与你最近的学习、生活状态有关。"
164
+ else:
165
+ return "你的分数低于50,这意味着你的心理状态正常健康,请继续保持!"
166
+
167
  def advice(
168
  radio1, radio2, radio3, radio4, radio5, radio6, text3_1, radio8, radio9, radio10,result1,result2,result3
169
  ):
 
178
  final_score=(((-1+result2+result3)/3)+1)*50
179
  else:
180
  final_score=(((0.5+result1+result2+result3)/3)+1)*50
181
+
182
 
183
+ SCORE_ANALYSIS=score_analysis(final_score)
184
  SLEEP = advice1(radio1, radio2, radio3)
185
  EAT = advice2(radio4)
186
  MOOD = advice3(radio5, radio6)
 
194
 
195
  FINAL_ADVICE = """
196
  <h1 style='text-align:center;'>检测报告</h1>
197
+ <h3 style='text-align:center;'>得分分析</h3>
198
+ &emsp;&emsp;{}\n
199
  <h3 style='text-align:center;'>睡眠状况</h3>
 
 
200
  &emsp;&emsp;{1}\n
201
+ <h3 style='text-align:center;'>饮食状况</h3>
202
  &emsp;&emsp;{2}\n
203
+ <h3 style='text-align:center;'>情绪状况</h3>
204
  &emsp;&emsp;{3}\n
 
205
  &emsp;&emsp;{4}\n
206
+ <h3 style='text-align:center;'>兴趣爱好</h3>
207
  &emsp;&emsp;{5}\n
208
+ <h3 style='text-align:center;'>近期情况</h3>
209
  &emsp;&emsp;{6}\n
210
+ <h3 style='text-align:center;'>结语</h3>
211
+ &emsp;&emsp;{7}\n
212
+ """.format(SCORE_ANALYSIS,SLEEP, EAT, MOOD, SUICIDE, INTEREST, RECENT, SUMMARY)
213
 
214
  return (
215
  gr.Column(visible=True),