# TensorFlow.js 毒性分类器 **Repository Path**: hu-yuanbiao/Offline_version_TensorFlow.js_Toxicity_Classifier ## Basic Information - **Project Name**: TensorFlow.js 毒性分类器 - **Description**: 这是一个使用TensorFlow.js的毒性文本分类器演示应用。该应用能够在浏览器中分析文本,检测是否包含攻击性内容(如辱骂、性暗示等)。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: https://www.modelscope.cn/studios/billkes/Offline_version_TensorFlow.js_Toxicity_Classifier/summary - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-23 - **Last Updated**: 2025-12-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README --- # 详细文档见https://modelscope.cn/docs/%E5%88%9B%E7%A9%BA%E9%97%B4%E5%8D%A1%E7%89%87 domain: #领域:cv/nlp/audio/multi-modal/AutoML # - cv tags: #自定义标签 - datasets: #关联数据集 evaluation: #- iic/ICDAR13_HCTR_Dataset test: #- iic/MTWI train: #- iic/SIBR models: #关联模型 #- iic/ofa_ocr-recognition_general_base_zh ## 启动文件(若SDK为Gradio/Streamlit,默认为app.py, 若为Static HTML, 默认为index.html) # deployspec: # entry_file: app.py license: Apache License 2.0 --- # TensorFlow.js Toxicity Classifier 这是一个使用TensorFlow.js的毒性文本分类器演示应用。该应用能够在浏览器中分析文本,检测是否包含攻击性内容(如辱骂、性暗示等)。 ## 功能特性 - 使用TensorFlow.js在浏览器中进行文本分类 - 离线模型支持(本地模型文件) - 实时文本分类 - 支持多种毒性类别检测 - 身份攻击 (identity_attack) - 侮辱 (insult) - 淫秽 (obscene) - 严重毒性 (severe_toxicity) - 威胁 (threat) - 毒性 (toxicity) ## 项目结构 ``` toxicity-html/ ├── index.html # 主页面 ├── favicon.svg # 网站图标 ├── js/ │ ├── tf.min.js # TensorFlow.js │ ├── toxicity.min.js # 毒性检测库 │ └── universal-sentence-encoder.min.js # 通用句子编码器 ├── toxicity-model/ # 毒性检测模型文件 ├── universal_sentence_encoder/ # 通用句子编码器模型文件 └── react-tox/ # React版本示例 ``` ## 使用方法 1. 确保所有依赖文件都在正确位置 2. 在浏览器中打开 `index.html` 3. 等待模型加载完成(页面显示"Loading model...") 4. 在输入框中输入文本并点击"Classify"按钮进行分析 ## 技术细节 - 使用Universal Sentence Encoder作为文本编码器 - 毒性模型基于Kaggle的Toxic Comment Classification Challenge数据集训练 - 所有模型文件都已本地化,支持离线使用 - 包含预设的测试样本 ## 浏览器兼容性 支持现代浏览器,包括Chrome、Firefox、Safari和Edge。 ## 离线功能 所有机器学习模型都已包含在项目中,无需网络连接即可使用。 ## 致谢 - TensorFlow.js团队 - Kaggle Toxic Comment Classification Challenge数据集