PinHsuan commited on
Commit
d11d03d
·
verified ·
1 Parent(s): 4c85c3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -96,12 +96,13 @@ def analyze_and_predict(*all_answers):
96
 
97
  return (
98
  gr.update(visible=False),
99
- gr.update(visible=True),
100
- f"### 診斷結果:{res_label}",
101
- {"風險機率": conf if pred_idx==1 else 1-conf, "健康程度": 1 - (conf if pred_idx==1 else 1-conf)},
102
- table_data,
103
- fig,
104
- fig
 
105
  )
106
 
107
  def reset_system():
@@ -154,7 +155,11 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
154
  btn_next.click(fn=lambda: gr.Tabs(selected=1), outputs=survey_tabs)
155
  back_to_ccmq.click(fn=lambda: gr.Tabs(selected=0), outputs=survey_tabs)
156
  back_to_edit.click(fn=lambda: (gr.update(visible=True), gr.update(visible=False)), outputs=[stage_1, stage_2])
157
- submit_btn.click(fn=analyze_and_predict, inputs=all_inputs, outputs=[stage_1, stage_2, res_title, res_desc, res_table, res_prob, res_table, plot_1, plot_2])
 
 
 
 
158
  finish_btn.click(fn=reset_system, outputs=[stage_1, stage_2, survey_tabs] + all_inputs)
159
 
160
  if __name__ == "__main__":
 
96
 
97
  return (
98
  gr.update(visible=False),
99
+ gr.update(visible=True),
100
+ f"### {res_label}",
101
+ advice_text,
102
+ {"風險機率": conf if pred_idx==1 else 1-conf, "健康程度": 1 - (conf if pred_idx==1 else 1-conf)}, # res_prob
103
+ table_data,
104
+ fig,
105
+ fig
106
  )
107
 
108
  def reset_system():
 
155
  btn_next.click(fn=lambda: gr.Tabs(selected=1), outputs=survey_tabs)
156
  back_to_ccmq.click(fn=lambda: gr.Tabs(selected=0), outputs=survey_tabs)
157
  back_to_edit.click(fn=lambda: (gr.update(visible=True), gr.update(visible=False)), outputs=[stage_1, stage_2])
158
+ submit_btn.click(
159
+ fn=analyze_and_predict,
160
+ inputs=all_inputs,
161
+ outputs=[stage_1, stage_2, res_title, res_desc, res_prob, res_table, plot_1, plot_2]
162
+ )
163
  finish_btn.click(fn=reset_system, outputs=[stage_1, stage_2, survey_tabs] + all_inputs)
164
 
165
  if __name__ == "__main__":