Spaces:
Running
Running
Hiroaki Ogasawara
commited on
Commit
•
d6da45f
1
Parent(s):
22ef21f
chore: エラーメッセージを表示
Browse files
app.py
CHANGED
@@ -29,10 +29,10 @@ def process_jsonl_file(jsonl_file_path: str, api_key: str):
|
|
29 |
) as temp_file:
|
30 |
temp_file.write(html_content)
|
31 |
output_file = temp_file.name
|
32 |
-
return output_file
|
33 |
|
34 |
except Exception as e:
|
35 |
-
return
|
36 |
|
37 |
|
38 |
# Gradioデモ
|
@@ -40,14 +40,15 @@ with gr.Blocks() as demo:
|
|
40 |
gr.Markdown("## ELYZA-tasks-100(-TV) セルフ評価ページ")
|
41 |
|
42 |
jsonl_input = gr.File(label="JSONLファイルをアップロード")
|
43 |
-
api_key_input = gr.Textbox(label="API
|
44 |
-
gr.Markdown("
|
45 |
-
process_button = gr.Button("
|
46 |
|
47 |
output_file = gr.File(label="セルフ評価レポート")
|
|
|
48 |
|
49 |
process_button.click(
|
50 |
-
process_jsonl_file, inputs=[jsonl_input, api_key_input], outputs=output_file
|
51 |
)
|
52 |
|
53 |
demo.launch()
|
|
|
29 |
) as temp_file:
|
30 |
temp_file.write(html_content)
|
31 |
output_file = temp_file.name
|
32 |
+
return output_file, ""
|
33 |
|
34 |
except Exception as e:
|
35 |
+
return None, e
|
36 |
|
37 |
|
38 |
# Gradioデモ
|
|
|
40 |
gr.Markdown("## ELYZA-tasks-100(-TV) セルフ評価ページ")
|
41 |
|
42 |
jsonl_input = gr.File(label="JSONLファイルをアップロード")
|
43 |
+
api_key_input = gr.Textbox(label="GeminiのAPIキー(スコアのセルフ評価を行う場合)", type="password")
|
44 |
+
gr.Markdown("APIキーの発行は[こちら](https://aistudio.google.com/app/apikey)")
|
45 |
+
process_button = gr.Button("レポートを作成")
|
46 |
|
47 |
output_file = gr.File(label="セルフ評価レポート")
|
48 |
+
output_text = gr.Textbox(label="システムメッセージ")
|
49 |
|
50 |
process_button.click(
|
51 |
+
process_jsonl_file, inputs=[jsonl_input, api_key_input], outputs=[output_file, output_text]
|
52 |
)
|
53 |
|
54 |
demo.launch()
|
utils.py
CHANGED
@@ -121,7 +121,7 @@ def report(tasks: list[dict]) -> str:
|
|
121 |
height: 1px;
|
122 |
background-color: #ddd;
|
123 |
}
|
124 |
-
.divider .
|
125 |
position: absolute;
|
126 |
margin: -8px;
|
127 |
left: 50%;
|
@@ -155,20 +155,20 @@ def report(tasks: list[dict]) -> str:
|
|
155 |
+ json.dumps(tasks)
|
156 |
+ """;
|
157 |
|
158 |
-
//
|
159 |
-
const createDivider = (
|
160 |
const divider = document.createElement('div');
|
161 |
divider.classList.add('divider');
|
162 |
|
163 |
const line = document.createElement('div');
|
164 |
line.classList.add('line');
|
165 |
|
166 |
-
const
|
167 |
-
|
168 |
-
|
169 |
|
170 |
divider.appendChild(line);
|
171 |
-
divider.appendChild(
|
172 |
|
173 |
return divider;
|
174 |
};
|
@@ -195,11 +195,11 @@ def report(tasks: list[dict]) -> str:
|
|
195 |
|
196 |
const container = document.getElementById('container');
|
197 |
|
198 |
-
messages.forEach((message) => {
|
199 |
const task = document.createElement('div');
|
200 |
task.classList.add('task');
|
201 |
|
202 |
-
task.appendChild(createDivider(message.task_id));
|
203 |
task.appendChild(createMessage(message.input, 'input'));
|
204 |
task.appendChild(createMessage(message.output, 'output'));
|
205 |
|
|
|
121 |
height: 1px;
|
122 |
background-color: #ddd;
|
123 |
}
|
124 |
+
.divider .taskName {
|
125 |
position: absolute;
|
126 |
margin: -8px;
|
127 |
left: 50%;
|
|
|
155 |
+ json.dumps(tasks)
|
156 |
+ """;
|
157 |
|
158 |
+
// taskName: str
|
159 |
+
const createDivider = (taskName) => {
|
160 |
const divider = document.createElement('div');
|
161 |
divider.classList.add('divider');
|
162 |
|
163 |
const line = document.createElement('div');
|
164 |
line.classList.add('line');
|
165 |
|
166 |
+
const taskNameLabel = document.createElement('div');
|
167 |
+
taskNameLabel.classList.add('taskName');
|
168 |
+
taskNameLabel.textContent = taskName;
|
169 |
|
170 |
divider.appendChild(line);
|
171 |
+
divider.appendChild(taskNameLabel);
|
172 |
|
173 |
return divider;
|
174 |
};
|
|
|
195 |
|
196 |
const container = document.getElementById('container');
|
197 |
|
198 |
+
messages.forEach((message, i) => {
|
199 |
const task = document.createElement('div');
|
200 |
task.classList.add('task');
|
201 |
|
202 |
+
task.appendChild(createDivider(message.task_id ? "Task ID: " + message.task_id : "Task Index" + i));
|
203 |
task.appendChild(createMessage(message.input, 'input'));
|
204 |
task.appendChild(createMessage(message.output, 'output'));
|
205 |
|