kevineen commited on
Commit
c74ccc5
1 Parent(s): 49de7dc

モード追加

Browse files
Files changed (1) hide show
  1. run.py +54 -42
run.py CHANGED
@@ -148,52 +148,64 @@ with gr.Blocks(theme=theme_, css=load_css()) as demo:
148
 
149
  dataset_display = gr.Markdown(visible=False)
150
 
151
- question_text = gr.Textbox(label="質問: ", interactive=False)
152
-
153
- with gr.Row(equal_height=True):
154
- good_btn = gr.Button("良い")
155
- bad_btn = gr.Button("悪い")
156
-
157
- gr.Markdown("#### 下記回答は、余裕があればで大丈夫です。")
158
-
159
- score_slider = gr.Slider(1, 5, label="スコア: 1-5 (1:大変悪い、2:悪い、3:普通、4:良い、5:大変良い)", step=1, value=score.value, interactive=True)
160
-
161
- answer_text = gr.Textbox(label="回答: 改行はShift+Enterです。 文章を修正して頂けると、さらに高品質になります。", elem_id="answer", interactive=True)
162
-
163
- data_load_btn.click(
164
- display_dataset,
165
- inputs=[gr_current_dataset],
166
- outputs=[dataset_display, question_text, answer_text],
167
- )
168
 
169
- # def good_click(profile, oauth_token):
170
- # print("good")
171
- # # インデックスを更新
172
- # current_idx.value = (current_idx.value + 1)
173
- # # current_dataset を更新
174
- # current_dataset.value = target_dataset.value['train'][current_idx.value]
175
 
176
- # print(current_dataset.value)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
 
178
- # # データを表示
179
- # question = current_dataset.value.get("question", "質問が見つかりません")
180
- # answer = current_dataset.value.get("answer", "解答が見つかりません")
181
- # return gr.update(visible=False), gr.update(value=question, interactive=False), gr.update(value=answer)
182
-
183
- # good_btn.click(
184
- # good_click,
185
- # inputs=[None, None], # Noneはprofileとoauth_tokenに相当
186
- # outputs=[dataset_display, question_text, answer_text]
187
- # )
188
-
189
- def bad_click():
190
- print("bad")
191
 
192
- bad_btn.click(
193
- bad_click,
194
- inputs=[],
195
- outputs=None
196
- )
 
 
 
 
197
 
198
  with gr.Tab("アノテ済みデータセット(管理画面)"):
199
 
 
148
 
149
  dataset_display = gr.Markdown(visible=False)
150
 
151
+ question_text = gr.Textbox(label="質問: ", interactive=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
+ with gr.Tab("シンプルモード"):
 
 
 
 
 
154
 
155
+ with gr.Column():
156
+
157
+ with gr.Row(equal_height=True):
158
+ good_btn = gr.Button("良い")
159
+ bad_btn = gr.Button("悪い")
160
+
161
+ answer_text = gr.Textbox(label="回答:",lines=20, interactive=False)
162
+
163
+ data_load_btn.click(
164
+ display_dataset,
165
+ inputs=[gr_current_dataset],
166
+ outputs=[dataset_display, question_text, answer_text],
167
+ )
168
+
169
+ # def good_click(profile, oauth_token):
170
+ # print("good")
171
+ # # インデックスを更新
172
+ # current_idx.value = (current_idx.value + 1)
173
+ # # current_dataset を更新
174
+ # current_dataset.value = target_dataset.value['train'][current_idx.value]
175
+
176
+ # print(current_dataset.value)
177
+
178
+ # # データを表示
179
+ # question = current_dataset.value.get("question", "質問が見つかりません")
180
+ # answer = current_dataset.value.get("answer", "解答が見つかりません")
181
+ # return gr.update(visible=False), gr.update(value=question, interactive=False), gr.update(value=answer)
182
+
183
+ # good_btn.click(
184
+ # good_click,
185
+ # inputs=[None, None], # Noneはprofileとoauth_tokenに相当
186
+ # outputs=[dataset_display, question_text, answer_text]
187
+ # )
188
+
189
+ def bad_click():
190
+ print("bad")
191
+
192
+ bad_btn.click(
193
+ bad_click,
194
+ inputs=[],
195
+ outputs=None
196
+ )
197
 
198
+ with gr.Tab("丁寧モード"):
 
 
 
 
 
 
 
 
 
 
 
 
199
 
200
+ score_slider = gr.Slider(1, 5, label="スコア: 1-5 (1:大変悪い、2:悪い、3:普通、4:良い、5:大変良い)", step=1, value=score.value, interactive=True)
201
+
202
+ answer_text = gr.Textbox(label="回答: 改行はShift+Enterです。 文章を修正して頂けると、さらに高品質になります。", lines=20, elem_id="answer", interactive=True)
203
+
204
+ data_load_btn.click(
205
+ display_dataset,
206
+ inputs=[gr_current_dataset],
207
+ outputs=[dataset_display, question_text, answer_text],
208
+ )
209
 
210
  with gr.Tab("アノテ済みデータセット(管理画面)"):
211