Qifan Zhang
commited on
Commit
•
ec1d54e
1
Parent(s):
a9489fb
feat: add thread lock and limit max data lines
Browse files- app.py +7 -2
- data/description.txt +3 -11
app.py
CHANGED
@@ -4,10 +4,10 @@ from typing import Optional
|
|
4 |
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
|
|
7 |
|
8 |
from utils import pipeline
|
9 |
from utils.models import list_models
|
10 |
-
from loguru import logger
|
11 |
|
12 |
|
13 |
def read_data(filepath: str) -> Optional[pd.DataFrame]:
|
@@ -39,6 +39,10 @@ def process(
|
|
39 |
else:
|
40 |
raise Exception('No input data')
|
41 |
|
|
|
|
|
|
|
|
|
42 |
# process
|
43 |
if task_name == 'Originality':
|
44 |
df = pipeline.p0_originality(df, model_name, pooling)
|
@@ -98,5 +102,6 @@ app = gr.Interface(
|
|
98 |
outputs=[text_output, dataframe_output, file_output],
|
99 |
description=open('data/description.txt', 'r').read(),
|
100 |
title='TransDis-CreativityAutoAssessment',
|
|
|
101 |
)
|
102 |
-
app.launch()
|
|
|
4 |
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
7 |
+
from loguru import logger
|
8 |
|
9 |
from utils import pipeline
|
10 |
from utils.models import list_models
|
|
|
11 |
|
12 |
|
13 |
def read_data(filepath: str) -> Optional[pd.DataFrame]:
|
|
|
39 |
else:
|
40 |
raise Exception('No input data')
|
41 |
|
42 |
+
# check
|
43 |
+
if len(df) > 10000:
|
44 |
+
raise Exception('Data exceeds 10,000 rows')
|
45 |
+
|
46 |
# process
|
47 |
if task_name == 'Originality':
|
48 |
df = pipeline.p0_originality(df, model_name, pooling)
|
|
|
102 |
outputs=[text_output, dataframe_output, file_output],
|
103 |
description=open('data/description.txt', 'r').read(),
|
104 |
title='TransDis-CreativityAutoAssessment',
|
105 |
+
concurrency_limit=1,
|
106 |
)
|
107 |
+
app.launch(max_threads=1)
|
data/description.txt
CHANGED
@@ -1,13 +1,5 @@
|
|
1 |
-
TransDis系统,是一个基于Transformer语言模型的语义距离评分系统,用于自动评估中文(或其他语言)的多用途任务(AUT)中的独创性和灵活性(论文见,https://link.springer.com/article/10.3758/s13428-023-02313-z
|
2 |
-
您可以选择用于评分的模型,请注意sentence-transformers_paraphrase-multilingual-mpnet-base-v2和sentence-transformers_paraphrase-multilingual-MiniLM-L12-v2可用于多语言,其他模型仅适用于英文或中文。 我们提供Pooling方法的选择,对于bert-base-chinese建议使用mean pooling。
|
3 |
-
如发生错误,请试着简化你的数据——用更少的行试试。如果不行,则可能是输入格式错误,请尝试重新保存为逗号分隔的CSV,然后再上传CSV文件。 如运行较慢,可以复制此空间至您的帐号,并选择升级版的硬件以提升处理速度。
|
4 |
-
如需更多帮助或报告其他bug,请联系ydd409@163.com。
|
5 |
|
6 |
-
TranDis, a semantic distance scoring system based on transformer-based language models, can be a useful tool to automatically assess originality and flexibility for AUT in Chinese or other languages (see the paper at
|
7 |
-
You can choose the model to use for scoring. Please note that sentence-transformers_paraphrase-multilingual-mpnet-base-v2 and sentence-transformers_paraphrase-multilingual-MiniLM-L12-v2 are applicable to multiple languages; cyclone_simcse-chinese-roberta-wwm-ext is only applicable to Chinese; sentence-transformers/all-mpnet-base-v2 and sentence-transformers/all-MiniLM-L12-v2 are only applicable to English.
|
8 |
-
If an error occurs, try simplifying your data - does it work with fewer rows? If not, the input format may be incorrect.
|
9 |
-
If the process is sluggish, you have the option to duplicate this space to your account and choose an enhanced hardware configuration for improved processing speed.
|
10 |
-
For more assistance or to report potential issues with our system, please contact ydd409@163.com.
|
11 |
|
12 |
-
Reference:
|
13 |
-
Yang, T., Zhang, Q., Sun, Z., & Hou, Y. (2023). Automatic Assessment of Divergent Thinking in Chinese Language with TransDis: A Transformer-Based Language Model Approach. Behavior Research Methods. https://doi.org/10.3758/s13428-023-02313-z
|
|
|
1 |
+
TransDis系统,是一个基于Transformer语言模型的语义距离评分系统,用于自动评估中文(或其他语言)的多用途任务(AUT)中的独创性和灵活性(论文见,https://link.springer.com/article/10.3758/s13428-023-02313-z )。 输入被试(id)+提示词+回答的数据,每行1个用途,用逗号隔开。您可以通过文本框直接输入数据,也可以上传用逗号隔开的CSV格式文件或xlsx文件作为输入,CSV输入优先级高于文本框输入。 您可以选择用于评分的模型,请注意sentence-transformers_paraphrase-multilingual-mpnet-base-v2和sentence-transformers_paraphrase-multilingual-MiniLM-L12-v2可用于多语言,其他模型仅适用于英文或中文。 我们提供Pooling方法的选择,对于bert-base-chinese建议使用mean pooling。 如发生错误,请试着简化你的数据——用更少的行试试。如果不行,则可能是输入格式错误,请尝试重新保存为逗号分隔的CSV,然后再上传CSV文件。 如运行较慢,可以复制此空间至您的帐号(我们建议这种方式),并选择升级版的硬件以提升处理速度。 如需更多帮助或报告其他bug,请联系ydd409@163.com。
|
|
|
|
|
|
|
2 |
|
3 |
+
TranDis, a semantic distance scoring system based on transformer-based language models, can be a useful tool to automatically assess originality and flexibility for AUT in Chinese or other languages (see the paper at https://link.springer.com/article/10.3758/s13428-023-02313-z). Enter your participant ID + prompt + response data, one per line, with a COMMA between each variable. You can either input data directly into the text box or upload a comma-separated CSV file or a XLSX file as input. Please note that if both methods are used, the CSV input will take precedence over the text box input. You can choose the model to use for scoring. Please note that sentence-transformers_paraphrase-multilingual-mpnet-base-v2 and sentence-transformers_paraphrase-multilingual-MiniLM-L12-v2 are applicable to multiple languages; cyclone_simcse-chinese-roberta-wwm-ext is only applicable to Chinese; sentence-transformers/all-mpnet-base-v2 and sentence-transformers/all-MiniLM-L12-v2 are only applicable to English. If an error occurs, try simplifying your data - does it work with fewer rows? If not, the input format may be incorrect. If the process is sluggish, you have the option to duplicate this space to your account (we recommend this approach) and choose an enhanced hardware configuration for improved processing speed. For more assistance or to report potential issues with our system, please contact ydd409@163.com.
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
Reference: Yang, T., Zhang, Q., Sun, Z., & Hou, Y. (2023). Automatic Assessment of Divergent Thinking in Chinese Language with TransDis: A Transformer-Based Language Model Approach. Behavior Research Methods. https://doi.org/10.3758/s13428-023-02313-z
|
|