Spaces:
Runtime error
Runtime error
theme 無くし
Browse files
run.py
CHANGED
@@ -6,7 +6,7 @@ from type.dataset_type import TanukiPhase2AnnotationDataset
|
|
6 |
js = """
|
7 |
# テキストボックスでEnterキーを無効化する
|
8 |
function blockEnter(event) {
|
9 |
-
|
10 |
const textbox = document.getElementById('answer');
|
11 |
textbox.addEventListener('keydown', (e) => {
|
12 |
if (e.key === 'Enter') {
|
@@ -55,17 +55,17 @@ def load_data(choice_dataset, oauth_token: gr.OAuthToken | None) -> str:
|
|
55 |
except Exception as e:
|
56 |
return None
|
57 |
|
58 |
-
|
59 |
def display_dataset(choice_dataset, profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None):
|
60 |
if profile is None:
|
61 |
return gr.update(visible=True, value="ログインしてデータセットを表示してください。"), None, None
|
|
|
62 |
first_data = load_data(choice_dataset, oauth_token)
|
63 |
if first_data:
|
64 |
# "train" スプリットの最初のデータを取得
|
65 |
current_dataset = first_data['train'][0]
|
66 |
current_index = 0
|
67 |
-
question = current_dataset.get("question", "
|
68 |
-
answer = current_dataset.get("answer", "
|
69 |
|
70 |
# 初期値を設定しておく
|
71 |
initial_answer_text = answer
|
|
|
6 |
js = """
|
7 |
# テキストボックスでEnterキーを無効化する
|
8 |
function blockEnter(event) {
|
9 |
+
document.addEventListener('DOMContentLoaded', (event) => {
|
10 |
const textbox = document.getElementById('answer');
|
11 |
textbox.addEventListener('keydown', (e) => {
|
12 |
if (e.key === 'Enter') {
|
|
|
55 |
except Exception as e:
|
56 |
return None
|
57 |
|
|
|
58 |
def display_dataset(choice_dataset, profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None):
|
59 |
if profile is None:
|
60 |
return gr.update(visible=True, value="ログインしてデータセットを表示してください。"), None, None
|
61 |
+
|
62 |
first_data = load_data(choice_dataset, oauth_token)
|
63 |
if first_data:
|
64 |
# "train" スプリットの最初のデータを取得
|
65 |
current_dataset = first_data['train'][0]
|
66 |
current_index = 0
|
67 |
+
question = current_dataset.get("question", "質問が見つかりません")
|
68 |
+
answer = current_dataset.get("answer", "解答が見つかりません")
|
69 |
|
70 |
# 初期値を設定しておく
|
71 |
initial_answer_text = answer
|