change
Browse files- app.py +32 -43
- custom_styles.css +0 -22
- flagged/log.csv +14 -0
app.py
CHANGED
@@ -22,62 +22,51 @@ def process_data(task_name, model_name, pooling_method, input_text, file=None):
|
|
22 |
|
23 |
return output, dataframe_output, file_output
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
gr.Markdown("<h1 style='text-align: center;'>TwoPhaseBERT-CreativityAutoAssessmen</h1>")
|
28 |
-
gr.Markdown(description_text)
|
29 |
-
|
30 |
-
# 固定布局:分成三列
|
31 |
-
with gr.Row():
|
32 |
-
with gr.Column():
|
33 |
-
task_dropdown = gr.Dropdown(
|
34 |
label="Task Name",
|
35 |
choices=["Creativity", "Appropriateness"],
|
36 |
-
value="Creativity"
|
37 |
-
|
38 |
-
|
39 |
label="Model Name",
|
40 |
choices=[
|
41 |
"One-phase Fine-tuned BERT",
|
42 |
"Two-phase Fine-tuned BERT"],
|
43 |
-
value="Two-phase Fine-tuned BERT"
|
44 |
-
|
45 |
-
|
46 |
label="Pooling",
|
47 |
choices=["mean", "cls"],
|
48 |
-
value="cls"
|
49 |
-
|
50 |
-
|
51 |
label="Text Input",
|
52 |
lines=10,
|
53 |
-
value=demo
|
54 |
-
|
55 |
-
|
56 |
label="Input File",
|
57 |
type="filepath",
|
58 |
-
file_types=[".csv", ".xlsx"]
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
output_box = gr.Textbox(label="Output", lines=5, interactive=False)
|
67 |
-
dataframe_output = gr.Dataframe(label="DataFrame", interactive=False)
|
68 |
-
file_output = gr.File(label="Output File", interactive=False)
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
)
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
)
|
81 |
|
82 |
# 启动界面
|
83 |
interface.launch()
|
|
|
22 |
|
23 |
return output, dataframe_output, file_output
|
24 |
|
25 |
+
## 输入组件
|
26 |
+
task_dropdown = gr.Dropdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
label="Task Name",
|
28 |
choices=["Creativity", "Appropriateness"],
|
29 |
+
value="Creativity")
|
30 |
+
|
31 |
+
model_dropdown = gr.Dropdown(
|
32 |
label="Model Name",
|
33 |
choices=[
|
34 |
"One-phase Fine-tuned BERT",
|
35 |
"Two-phase Fine-tuned BERT"],
|
36 |
+
value="Two-phase Fine-tuned BERT")
|
37 |
+
|
38 |
+
pooling_dropdown = gr.Dropdown(
|
39 |
label="Pooling",
|
40 |
choices=["mean", "cls"],
|
41 |
+
value="cls")
|
42 |
+
|
43 |
+
text_input = gr.Textbox(
|
44 |
label="Text Input",
|
45 |
lines=10,
|
46 |
+
value=demo)
|
47 |
+
|
48 |
+
file_input = gr.File(
|
49 |
label="Input File",
|
50 |
type="filepath",
|
51 |
+
file_types=[".csv", ".xlsx"])
|
52 |
+
|
53 |
+
## 输出组件
|
54 |
+
output_box = gr.Textbox(label="Output", lines=5, interactive=False)
|
55 |
+
|
56 |
+
dataframe_output = gr.Dataframe(label="DataFrame", interactive=False)
|
57 |
+
|
58 |
+
file_output = gr.File(label="Output File", interactive=False)
|
|
|
|
|
|
|
59 |
|
60 |
+
# 构建Gradio界面
|
61 |
+
interface = gr.Interface(
|
62 |
+
fn=process_data,
|
63 |
+
inputs=[task_dropdown, model_dropdown, pooling_dropdown, text_input, file_input],
|
64 |
+
outputs=[output_box, dataframe_output, file_output],
|
65 |
+
css=(".file-download {display: none !important;}"),
|
66 |
+
title="TwoPhaseBERT-CreativityAutoEvaluation",
|
67 |
+
description=description_text,
|
68 |
+
theme=gr.themes.Soft(),
|
69 |
+
)
|
|
|
70 |
|
71 |
# 启动界面
|
72 |
interface.launch()
|
custom_styles.css
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
/* Center align Submit and Clear buttons */
|
2 |
-
#render {background: hsl(262, 57%, 88%) !important;
|
3 |
-
color: hsl(0, 91%, 69%)!important;
|
4 |
-
}
|
5 |
-
|
6 |
-
.custom-submit {
|
7 |
-
background-color: hsl(240, 38%, 55%) !important;
|
8 |
-
color: hsl(0, 85%, 74%) !important;
|
9 |
-
border: none !important;
|
10 |
-
padding: 10px 20px !important;
|
11 |
-
cursor: pointer !important;
|
12 |
-
border-radius: 5px !important;
|
13 |
-
}
|
14 |
-
|
15 |
-
.custom-clear {
|
16 |
-
background-color: lightgray !important;
|
17 |
-
color: black !important;
|
18 |
-
border: none !important;
|
19 |
-
padding: 10px 20px !important;
|
20 |
-
cursor: pointer !important;
|
21 |
-
border-radius: 5px !important;
|
22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flagged/log.csv
CHANGED
@@ -1,2 +1,16 @@
|
|
1 |
Task Name,Model Name,Pooling,Text Input,Input File,Output,flag,username,timestamp
|
2 |
Originality,sentence-transformers/paraphrase-multilingual-mpnet-base-v2,mean,,,,,,2024-12-13 13:57:00.404823
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
Task Name,Model Name,Pooling,Text Input,Input File,Output,flag,username,timestamp
|
2 |
Originality,sentence-transformers/paraphrase-multilingual-mpnet-base-v2,mean,,,,,,2024-12-13 13:57:00.404823
|
3 |
+
Creativity,Two-phase Fine-tuned BERT,cls,"prompt,response
|
4 |
+
布団, 畑の野菜にかぶせるために使う。
|
5 |
+
布団, 家を作るのに使う。
|
6 |
+
布団, 布団でぶつかりあって友達と遊ぶ。
|
7 |
+
布団, 寝るときに下に敷いて使う。
|
8 |
+
コップ, 牛乳を飲むために使う。
|
9 |
+
コップ, タワーを作る。
|
10 |
+
コップ, 頭の上両手両足を駆使して誰が一番コップを高く積んでバランスを保てるかを競う。
|
11 |
+
コップ, コップを叩いて音を鳴らして楽器にする。
|
12 |
+
テーブル, 椅子代わりにする。
|
13 |
+
テーブル, 車のタイヤ
|
14 |
+
テーブル, 子供が遊ぶ場所
|
15 |
+
テーブル, 朝食をおいて食べました。
|
16 |
+
",,,"{""headers"": [""1"", ""2"", ""3""], ""data"": [["""", """", """"]], ""metadata"": null}",,,,2024-12-14 00:12:07.193074
|