Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

英语作文自动评分系统 | Auto-Essay-Grader

Auto Essay Grader 是一个基于大语言模型 API 的自动评分工具。上传包含作文的 Excel 文件,其中作文在一列里,然后选择模型,提供作文题目和评分标准,工具就会自动批量生成分数和评语。
Auto Essay Grader is an automated tool for grading essays using language model APIs. Upload an Excel file with essays (in one column), select a model, provide the essay prompt and grading criteria, and the tool will automatically generate scores in bulk.

Image 1 Image 2

The left image is the GUI client, the right-side image is the server.

通知 | notifications

作者原本计划的商业化分支的功能已经并回开源主仓库了,所以现在这个仓库同时包含了之前计划放在商业化分支的功能。
Readme暂未更新,后续会更新。仓库说明和目录结构说明也会在后续更新。 作者短期内将不再维护此开源代码。后续大部分服务端的维护将转为闭源。Python编写的客户端将继续开源,但更新时间可能延后于release版本,因为开源时需要整理文件内容

功能特性 | Features

批量作文输入: 将需要评分的作文内容放入 Excel 文件的同一列,删除表头,让第一排就有内容。
模型选择: 选择所需的语言模型进行评分。
自定义作文题目: 输入作文题目或要求以确保评分的准确性。
评分标准: 根据任务要求,定义评分标准,如任务回应、连贯性、词汇多样性、语法准确性等。
自动评分: 基于大语言模型 API,自动批量为作文评分。

Bulk Essay Input: Place the essays that need to be graded into a single column in an Excel file, remove the header, and ensure that the first row contains content.
Model Selection: Choose the language model you want to use for grading.
Custom Essay Prompt: Input the essay prompt to ensure accurate grading.
Grading Criteria: Define grading standards such as task response, coherence, lexical resource, and grammatical accuracy.
Automated Grading: Automatically batch grade essays using a large language model API.

使用方法 | Usage Instruction

安装依赖库 | install dependencies

运行以下指令安装依赖项 | Run the following command to install all the dependencies
pip install -r requirements.txt

配置 | Settings

打开初始化程序initialize_config.pyinitialize_config.exe
按照指令,输入你的通义千问API Key、后端地址、端口等信息。若无需更改,直接按回车即可。
请注意,如果您对程序一窍不通,可以只输入API-key后,一直按回车即可。
配置好后,运行后端程序。

Open the initialization program initialize_config.py or initialize_config.exe,
follow the instructions, and enter your Qianwen API-Key, backend address, port, and other information. If no changes are needed, simply press Enter.
Please note, if you are not familiar with the program, you can just enter the API key and keep pressing Enter.
After configuring, run the backend program.

运行后端和前端 | Run Backend and Frontend Programs

先运行 server.py 启动后端服务,然后运行 GUIClient.py 启动前端界面。
或依次运行server.exeGUIClient.exe
在Linux系统上使用nohup python3 server.py > EssayJudgemmentOutput.log 2>&1 &来保存日志。

First, run server.py to start the backend service, and then run GUIClient.py to launch the frontend interface.
or run server.exe and GUIClient.exe. use nohup python3 server.py > EssayJudgemmentOutput.log 2>&1 & on Linux to save the log.

准备 Excel 文件:

将需要评分的作文内容存入 Excel 文件中的某一列,并确保删除表头,只保留作文内容(不需要删除其他列)。
保存文件为 .xls 格式(不建议使用 .xlsx 格式,但程序仍然可以运行)。

Place essays in a single column (do not need delete other columns), remove the header, and save as .xls (or .xlsx, though not recommended).

选择使用的评分模型 | Select a Model

模型/Model 推荐 Recommend
max 性能优异,但价格高 High performance, but expensive
plus 最推荐的选项,性价比高 Most recommended, great value
turbo 性能一般,价格较低 Lower performance, more affordable

导入文件 | Import the File

将编辑好的 Excel 文件拖入程序指定的文件路径栏中,并输入作文所在的列数。
Drag the Excel file into the program and enter the essay column number.

填写作文题目和评分标准 | Enter Essay Prompt & Grading Criteria

输入作文的题目和相应的评分标准(如任务回应、连贯性、词汇多样性、语法准确性等)。 Input the essay prompt and grading criteria.

提交并评分 | Submit

点击“提交”按钮,程序将开始自动评分。稍作等待,系统将生成分数并输出结果。
Click "提交"(means submit) and wait for the scores to be generated.

3. 打包成exe方法 | How to package into exe

使用pip安装pyinstaller,pip install pyinstaller
运行pip show pyinstaller,打开输出内容显示的“Location”,
用文本编辑器(例如Windows自带的文本编辑器、vscode等)打开GUIClient.spec
将Location后的字符串替换掉文件中8-18行的YOUR FILE PATH

若你的系统/目标系统不是win-x64平台,使用请打开该路径下的文件夹“tkinterdnd2”,再打开“tkdnd”。
在这个文件夹中可以看见多个系统版本,选择你电脑/目标电脑的版本(此处我选择win-x64)的文件夹打开。
将这里面的文件路径,替换掉文件中的8-18行的文件路径即可(文件数量不一定一样)。 然后运行pyinstaller GUIClient.spec即可。

Use pip to install PyInstaller: pip install pyinstaller
Then, run: pip show pyinstaller
In the output, find and open the "Location" shown using a text editor (e.g., Notepad, VS Code).
Open the file GUIClient.spec and replace the string in lines 8-18 that says YOUR FILE PATH with the path shown after "Location".

If your system/target system is not on the win-x64 platform, go to the folder named "tkinterdnd2" in the Location path, then open the "tkdnd" folder.
In this folder, you'll see multiple system versions—choose the folder that matches your computer's/target computer's version (for example, I chose win-x64).
Replace the file paths in lines 8-18 of the .spec file with the corresponding file paths from the selected system version (note that the number of files may vary).
Finally, run pyinstaller GUIClient.spec.

Todo

功能开发

短期内计划实现功能

  • 配置文件解耦,脱离主程序
  • 拥有初始化应用程序,引导用户更改api-key等设置
  • 每30s自动保存文本框中的内容
  • 支持多语言选择
  • 增加结构化输出提示词,保证大模型输出稳定
  • 增加token统计

普通功能

  • 初始化文件initialize_config.py支持双语
  • config.json中可以直接修改默认模型,方便后台更新
  • 后端集成充值等功能
  • 后端新增用户管理文件,使用json存储
  • 增加结构化输出提示词,保证大模型输出稳定
  • 后台日志输出保存为文件
  • 在每次用户提交操作后,统计使用的资源
  • 评分与评语分两列给出
  • 提供深色模式
  • 日志文件输出到文件(而非控制台输出)并定期备份/删除
  • 批量文件处理
  • 在文件处理完成后直接显示统计图
  • 在处理完每一篇论文后自动保存(而不是最后一起写入文档)
  • 增加bug反馈按钮

商业化功能

  • 后端实现用户增删查改
  • 前端实现用户登录功能
  • 添加用户资料编辑界面
  • 前后端集成支付充值系统
  • 加密软件避免破解
  • 后端实现计费功能,保证前端被破解后也无法调用接口
  • 根据教学大纲自动生成配套的作文题,并编写配套前端,自动收集作业。
  • 在上一条的基础上,让一学期的作文练习过程全部自动化
  • 使用batch调用,降低成本
  • 加入AIGC检测
  • 优化UI界面
  • 将评分过程拆开为3步:1. 先让大模型解构题目,分得分点,并让用户确认;2. 用传统方法识别拼写、语法错误,计入得分;3. 将语法错误自动修复(可配置是否修复)后给大模型评分,减少评分误差
  • 性能优化:使用C#(WIN32 API)重构客户端(即不再适配Mac OS)(Tips. 多久Macbook Air 16+512的价格比我两台Windows加起来价格便宜就可以准备适配了
  • Windows会显示“未响应”,但是实际软件正在后台运算,通过多线程优化此情况
  • 优化界面美观程度:添加图标、图片或背景色等,改善视觉效果
  • 作文分自然段段评估、结合原始方法(词汇、语法等)进行评分

性能优化

  • 提升应用加载速度:python打包为exe的固有缺陷,使用electron或其他合适技术重写
  • Windows会显示“未响应”,但是实际软件正在后台运算,优化此情况
  • 减少内存占用
  • 减少存储空间占用

其他

  • 添加用户协议文档

更新日志 | Update

Dec. 23, 2024

  • 前端实现用户登录功能
  • 后端实现用户增删查改
  • 初始化文件initialize_config.py支持双语
  • config.json中可以直接修改默认模型,方便后台更新
  • 后端集成充值等功能
  • 后端新增用户管理文件,使用json存储
  • 增加结构化输出提示词,保证大模型输出稳定
  • 增加token统计
  • 增加计费倍率:使用a元的api后,以x倍的倍率计入用户价格
  • 前后端集成支付充值系统:卡密的形式支付
  • 后端实现计费功能,保证前端被破解后也无法调用接口
  • 增加了自动保存密码功能,提升用户体验
  • 引入了余额显示和充值页面。
  • 增加了从后台获取和更新用户余额的功能。
  • 实现了充值操作和余额查询功能。
  • 添加了PIN生成和卡PIN存储功能,并加入了编码/解码逻辑。
  • 通过添加密码哈希和PIN验证增强了安全性

Nov. 11, 2024

  • 配置文件解耦,单独存于json文件中,脱离主程序;
  • prompt解耦,单独存于txt文件中,使得程序的应用更广,可以通过更改criteria.txtrulePlaySettings.txt来更改默认配置(不建议修改rulePlaySettings);
  • 增加初始化程序,让用户一键运行;
  • 拥有初始化应用程序,引导用户更改api-key等设置;
  • 每30s自动保存文本框中的内容,保存于criteria.txt中;
  • 初步将文本内容解耦,已建立文件,但目前还没有全部开发完成。

Nov. 17, 2024

  • 多语言支持
  • 修复部分bug
  • 增加默认prompt使得生成内容的格式更加稳定,避免出现报错

English Version

  • Configuration files decoupled and stored in JSON files, separated from the main program.
  • Prompts decoupled and stored in TXT files to make the program more versatile. Changes to criteria.txt and rulePlaySettings.txt can adjust default settings. Not recommended to change rulePlaySettings.
  • Added an initialization program for one-click operation.
  • Has an initialization app that guides users to change settings like API keys.
  • Automatically saves text box content every 30 seconds into criteria.txt.
  • Text content decoupling started; files created but not fully developed yet.

免责声明 | Disclaimer

icon.ico 文件是在 2024 年 10 月 16 日使用阿里巴巴通义千问大模型生成的。作者提供了生成所需的提示信息。该文件的版权遵循该公司规定。
The icon.ico file was generated using the Qwen large model by Alibaba on October 16, 2024. The author provided the necessary prompts for its creation. The copyright of this file is subject to the company's terms.

重要开源更新

  1. 之前原本为商业化分支准备的功能已经并回开源主仓库。
  2. 仓库现在同时包含桌面端和网页端,不再只有 Tk 客户端。

当前目录结构

Auto-Essay-Grader/
├─ client/   # 桌面端(Tk GUI)
├─ server/   # 后端服务与处理逻辑
├─ src/      # 配置、用户数据、卡密数据
├─ web/      # 网页端
├─ requirements.txt
└─ README.md

其中:

  • client/GUIClient.py:桌面端入口
  • server/server.py:后端入口
  • web/client/:网页主界面
  • web/charge/:登录、注册、充值页面
  • web/config.js:网页端后端地址配置

已合并的功能

当前开源仓库已统一包含这些能力:

  • 批量作文评分
  • 用户登录 / 注册
  • 余额与充值逻辑
  • 桌面端客户端
  • 网页端前端
  • 用户资料页与基础账户信息读取
  • 文件上传、异步处理、结果下载链路

运行方式

1. 配置后端与客户端

项目的主配置文件现在位于:

src/config.json

桌面端初始化脚本位于:

python client/initialize_config.py

2. 启动后端

python server/server.py

后端默认运行在:

http://127.0.0.1:5000

3. 使用桌面端

python client/GUIClient.py

4. 使用网页端

网页端代码位于 web/。推荐用一个静态文件服务打开,而不是直接双击 HTML。

例如:

cd web
python -m http.server 5500

然后访问:

http://127.0.0.1:5500/client/index.html

网页端配置

网页端不再在脚本里硬编码后端地址,统一通过下面这个文件控制:

web/config.js

默认配置示例:

window.AEG_WEB_CONFIG = {
    backendMode: "local",
    backends: {
        local: "http://127.0.0.1:5000",
        default: "http://127.0.0.1:5000",
    },
};

目前支持的思路是:

  • backendMode: "local":连接本机后端
  • backendMode: "default":连接默认后端地址

如果后续你有自己的部署地址,可以直接改 backends.default

说明

  • 用户数据位于 src/userData.json
  • 卡密数据位于 src/cardPIN.json
  • 处理后的上传文件位于 server/uploads/
  • 桌面端与网页端现在共用同一套后端接口

Todo

  • 启动 server/server.py 后自动打开网页端
  • 继续整理网页端与桌面端的配置项,减少重复配置
  • 让界面更现代化,继续优化视觉风格和交互细节
  • 完善网页端帮助页、异常提示和处理进度体验
  • 补充更稳定的部署说明和打包说明

About

Auto Essay Grader 是一个基于大语言模型 API 的自动评分工具。上传包含作文的 Excel 文件,其中作文在一列里,然后选择模型,提供作文题目和评分标准,工具就会自动批量生成分数和评语。

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages