Spaces:
Runtime error
Runtime error
add batch test
Browse files- ape/ape.py +4 -3
- ape/data/test_loader2.txt +5 -0
- app.py +2 -2
ape/ape.py
CHANGED
|
@@ -53,9 +53,10 @@ def single_test(test_prompt, instruction, input, openai_key):
|
|
| 53 |
global LLM
|
| 54 |
if LLM is None:
|
| 55 |
LLM = LLMGPT(openai_key)
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
def score_single(eval_prompt, instance, instruction, openai_key):
|
|
|
|
| 53 |
global LLM
|
| 54 |
if LLM is None:
|
| 55 |
LLM = LLMGPT(openai_key)
|
| 56 |
+
output = []
|
| 57 |
+
for i in input.split('\n'):
|
| 58 |
+
output.append(LLM.generate_output(test_prompt, instruction, i)['text'])
|
| 59 |
+
return '\n'.join(output)
|
| 60 |
|
| 61 |
|
| 62 |
def score_single(eval_prompt, instance, instruction, openai_key):
|
ape/data/test_loader2.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
横结肠造口还纳术 横结肠造口闭合术
|
| 2 |
+
右肾上腺巨大肿瘤切除术 肾上腺病损切除术
|
| 3 |
+
左侧单侧乳房根治性切除术 单侧根治性乳房切除术
|
| 4 |
+
经皮三叉神经半月节射频热凝术 三叉神经半月节射频热凝术
|
| 5 |
+
经内镜支撑喉镜下双侧声带小结摘除术 内镜下声带病损切除术
|
app.py
CHANGED
|
@@ -71,7 +71,7 @@ with gr.Blocks(title="Automatic Prompt Engineer", theme=gr.themes.Glass()) as de
|
|
| 71 |
with gr.Row():
|
| 72 |
with gr.Column(scale=1):
|
| 73 |
test_instruction = gr.Textbox(lines=4, value="", label="Prompt to test")
|
| 74 |
-
test_input = gr.Textbox(lines=1, value="", label="
|
| 75 |
test_button = gr.Button("Test")
|
| 76 |
with gr.Column(scale=1):
|
| 77 |
test_output = gr.Textbox(lines=9, value="", label="Model Output")
|
|
@@ -111,4 +111,4 @@ with gr.Blocks(title="Automatic Prompt Engineer", theme=gr.themes.Glass()) as de
|
|
| 111 |
# 7. 输入指令打分
|
| 112 |
score_button.click(score_single, [eval_prompt, instance, score_instruction, openai_key], [test_score])
|
| 113 |
|
| 114 |
-
demo.launch(show_error=True)
|
|
|
|
| 71 |
with gr.Row():
|
| 72 |
with gr.Column(scale=1):
|
| 73 |
test_instruction = gr.Textbox(lines=4, value="", label="Prompt to test")
|
| 74 |
+
test_input = gr.Textbox(lines=1, value="", label="Inputs used to test prompt[多个输入以换行分割]")
|
| 75 |
test_button = gr.Button("Test")
|
| 76 |
with gr.Column(scale=1):
|
| 77 |
test_output = gr.Textbox(lines=9, value="", label="Model Output")
|
|
|
|
| 111 |
# 7. 输入指令打分
|
| 112 |
score_button.click(score_single, [eval_prompt, instance, score_instruction, openai_key], [test_score])
|
| 113 |
|
| 114 |
+
demo.launch(show_error=True)
|