jslin09 commited on
Commit
aadf949
1 Parent(s): a4b8d89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -114,21 +114,25 @@ with gr.Blocks() as demo:
114
  with gr.Row():
115
  with gr.Column():
116
  btn = gr.Button("隨機選擇")
 
117
  with gr.Row():
118
  element = gr.components.Textbox(lines=2, label="構成要件要素")
119
- tag = gr.Dropdown(choices = [("被告(犯罪主體)","<LEO_SOC>"), ("主觀犯意", "<LEO_SLE>"), ("不法行為","<LEO_ACT>"), ("因果關係","<LEO_CAU>"),
120
  ("被害人/告訴人","<LEO_VIC>"), ("危害結果","<LEO_ROH>"), ("未遂","<LEO_ATP>"), ("既遂","<LEO_ACC>"),
121
  ("中止","<LEO_ABA>"), ("預備","<LEO_PRP>")],
122
- label="標籤", info="構成要件要素的標籤", type='value')
123
  with gr.Column():
124
  result = gr.components.Textbox(lines=5, label="語料內容", show_copy_button=True)
125
  with gr.Row():
126
  with gr.Column():
127
- btn2 = gr.Button("產生標註語料內容")
128
- btn3 = gr.Button("下載")
 
 
129
  btn.click(random_next, inputs=[], outputs=[courtName, caseNo, prompt, filename])
130
  btn2.click(gen_template, inputs=[prompt, element, tag], outputs=[result])
131
  btn3.click(None, inputs=[result, filename], _js=js_download)
 
132
 
133
  if __name__ == "__main__":
134
  demo.launch() # 在遠端啟動時,需要 share=True 。
 
114
  with gr.Row():
115
  with gr.Column():
116
  btn = gr.Button("隨機選擇")
117
+ btn4 = gr.ClearButton(value="清除標註內容",[result, element, tag])
118
  with gr.Row():
119
  element = gr.components.Textbox(lines=2, label="構成要件要素")
120
+ tag = gr.Dropdown(choices = [("被告(犯罪主體)","<LEO_SOC>"), ("主觀犯意", "<LEO_SLE>"), ("不法行為","<LEO_ACT>"), ("因果關係","<LEO_CAU>"),
121
  ("被害人/告訴人","<LEO_VIC>"), ("危害結果","<LEO_ROH>"), ("未遂","<LEO_ATP>"), ("既遂","<LEO_ACC>"),
122
  ("中止","<LEO_ABA>"), ("預備","<LEO_PRP>")],
123
+ label="標籤", info="構成要件要素的標籤", type='value')
124
  with gr.Column():
125
  result = gr.components.Textbox(lines=5, label="語料內容", show_copy_button=True)
126
  with gr.Row():
127
  with gr.Column():
128
+ with gr.Row():
129
+ btn2 = gr.Button("產生標註語料內容")
130
+ with gr.Row():
131
+ btn3 = gr.Button("下載")
132
  btn.click(random_next, inputs=[], outputs=[courtName, caseNo, prompt, filename])
133
  btn2.click(gen_template, inputs=[prompt, element, tag], outputs=[result])
134
  btn3.click(None, inputs=[result, filename], _js=js_download)
135
+ btn4.click(None, [result, element, tag])
136
 
137
  if __name__ == "__main__":
138
  demo.launch() # 在遠端啟動時,需要 share=True 。