kevineen commited on
Commit
73946b5
1 Parent(s): 06cc54c

dataset 選択

Browse files
Files changed (1) hide show
  1. run.py +12 -12
run.py CHANGED
@@ -57,17 +57,17 @@ def toggle_buttons(profile: gr.OAuthProfile | None):
57
  return gr.update(visible=False), gr.update(visible=True)
58
 
59
 
60
- def load_data(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None) -> str:
61
  if oauth_token is None:
62
- return "Please log in to load your datasets."
63
- dataset = load_dataset("kanhatakeyama/OrcaJaMixtral8x22b")
64
  return dataset
65
 
66
 
67
- def display_dataset(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None):
68
  if profile is None:
69
  return gr.update(visible=True, value="ログインしてデータセットを表示してください。"), None, None
70
- dataset = load_data(profile, oauth_token=oauth_token.token)
71
  if dataset:
72
  # "train" スプリットの最初のデータを取得
73
  first_data = dataset['train'][0]
@@ -90,7 +90,7 @@ theme_ = gr.State("Light")
90
 
91
  with gr.Blocks(theme=theme_, css=load_css()) as demo:
92
 
93
- gr.Markdown("# 自動生成データセット アノテーション for Tanuki 2Phase")
94
 
95
  with gr.Tab("アノテーション"):
96
 
@@ -118,7 +118,8 @@ with gr.Blocks(theme=theme_, css=load_css()) as demo:
118
 
119
  with gr.Row():
120
 
121
- choice_dataset = gr.Dropdown(label="アノテーションするデータセット", choices=dataset_list,
 
122
  value="a", elem_id="dataset_sel")
123
 
124
  data_load_btn = gr.Button("データセットを読み込む")
@@ -135,15 +136,14 @@ with gr.Blocks(theme=theme_, css=load_css()) as demo:
135
  answer_text = gr.Textbox(label="回答: 改行はShift+Enterです。", elem_id="answer", interactive=True)
136
 
137
  data_load_btn.click(
138
- display_dataset,
139
- inputs=None,
140
- outputs=[dataset_display, question_text, answer_text],
141
- )
142
 
143
  def on_submit(answer_text):
144
  return f" {answer_text}"
145
 
146
-
147
  with gr.Tab("アノテ済みデータセット"):
148
 
149
  gr.Textbox("データセットID", lines=1, placeholder="データセットIDを入力してください。")
 
57
  return gr.update(visible=False), gr.update(visible=True)
58
 
59
 
60
+ def load_data(choice_dataset, profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None) -> str:
61
  if oauth_token is None:
62
+ return "ログインしてからデータセットを表示してください。"
63
+ dataset = load_dataset(choice_dataset)
64
  return dataset
65
 
66
 
67
+ def display_dataset(choice_dataset, profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None):
68
  if profile is None:
69
  return gr.update(visible=True, value="ログインしてデータセットを表示してください。"), None, None
70
+ dataset = load_data(choice_dataset, profile, oauth_token)
71
  if dataset:
72
  # "train" スプリットの最初のデータを取得
73
  first_data = dataset['train'][0]
 
90
 
91
  with gr.Blocks(theme=theme_, css=load_css()) as demo:
92
 
93
+ gr.Markdown("# データセット アノテーション for Tanuki (2Phase)")
94
 
95
  with gr.Tab("アノテーション"):
96
 
 
118
 
119
  with gr.Row():
120
 
121
+ choice_dataset = gr.Dropdown(label="アノテーションするデータセット",
122
+ choices=dataset_list,
123
  value="a", elem_id="dataset_sel")
124
 
125
  data_load_btn = gr.Button("データセットを読み込む")
 
136
  answer_text = gr.Textbox(label="回答: 改行はShift+Enterです。", elem_id="answer", interactive=True)
137
 
138
  data_load_btn.click(
139
+ display_dataset,
140
+ inputs=[choice_dataset],
141
+ outputs=[dataset_display, question_text, answer_text],
142
+ )
143
 
144
  def on_submit(answer_text):
145
  return f" {answer_text}"
146
 
 
147
  with gr.Tab("アノテ済みデータセット"):
148
 
149
  gr.Textbox("データセットID", lines=1, placeholder="データセットIDを入力してください。")