From f5900179e00c20a2f7f4c0235b772cc0dcc7bdcb Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 8 Dec 2023 18:17:53 +0800 Subject: [PATCH] model tags classifier --- frontend/src/_locales/ja/main.json | 10 +- frontend/src/_locales/zh-hans/main.json | 10 +- frontend/src/pages/Models.tsx | 36 ++- frontend/src/stores/commonStore.ts | 5 + frontend/src/types/models.ts | 1 + frontend/src/utils/index.tsx | 7 +- manifest.json | 330 +++++++++++++++++++++--- 7 files changed, 354 insertions(+), 45 deletions(-) diff --git a/frontend/src/_locales/ja/main.json b/frontend/src/_locales/ja/main.json index 34f6482..4259266 100644 --- a/frontend/src/_locales/ja/main.json +++ b/frontend/src/_locales/ja/main.json @@ -303,5 +303,13 @@ "Please select a MIDI device first": "まずMIDIデバイスを選択してください", "Piano is the main instrument": "ピアノはメインの楽器です", "Loss is too high, please check the training data, and ensure your gpu driver is up to date.": "Lossが大きすぎます、トレーニングデータを確認し、GPUドライバが最新であることを確認してください。", - "This version of RWKV is not supported yet.": "このバージョンのRWKVはまだサポートされていません。" + "This version of RWKV is not supported yet.": "このバージョンのRWKVはまだサポートされていません。", + "Main": "メイン", + "Finetuned": "微調整", + "Global": "グローバル", + "Local": "ローカル", + "CN": "中国語", + "JP": "日本語", + "Music": "音楽", + "Other": "その他" } \ No newline at end of file diff --git a/frontend/src/_locales/zh-hans/main.json b/frontend/src/_locales/zh-hans/main.json index 2ac2431..c627bcd 100644 --- a/frontend/src/_locales/zh-hans/main.json +++ b/frontend/src/_locales/zh-hans/main.json @@ -303,5 +303,13 @@ "Please select a MIDI device first": "请先选择一个MIDI设备", "Piano is the main instrument": "钢琴为主", "Loss is too high, please check the training data, and ensure your gpu driver is up to date.": "Loss过高,请检查训练数据,并确保你的显卡驱动是最新的", - "This version of RWKV is not supported yet.": "暂不支持此版本的RWKV" + "This version of RWKV is not supported yet.": "暂不支持此版本的RWKV", + "Main": "主干", + "Finetuned": "微调", + "Global": "全球", + "Local": "本地", + "CN": "中文", + "JP": "日文", + "Music": "音乐", + "Other": "其他" } \ No newline at end of file diff --git a/frontend/src/pages/Models.tsx b/frontend/src/pages/Models.tsx index 3b28d7b..30616fb 100644 --- a/frontend/src/pages/Models.tsx +++ b/frontend/src/pages/Models.tsx @@ -1,5 +1,6 @@ -import React, { FC } from 'react'; +import React, { FC, useEffect, useState } from 'react'; import { + Button, Checkbox, createTableColumn, DataGrid, @@ -154,6 +155,22 @@ const columns: TableColumnDefinition[] = [ const Models: FC = observer(() => { const { t } = useTranslation(); + const [tags, setTags] = useState>([]); + const [modelSourceList, setModelSourceList] = useState(commonStore.modelSourceList); + + useEffect(() => { + setTags(Array.from(new Set( + [...commonStore.modelSourceList.map(item => item.tags || []).flat() + .filter(i => !i.includes('Other') && !i.includes('Local')) + , 'Other', 'Local']))); + }, [commonStore.modelSourceList]); + + useEffect(() => { + if (commonStore.activeModelListTags.length === 0) + setModelSourceList(commonStore.modelSourceList); + else + setModelSourceList(commonStore.modelSourceList.filter(item => commonStore.activeModelListTags.some(tag => item.tags?.includes(tag)))); + }, [commonStore.modelSourceList, commonStore.activeModelListTags]); return ( { value={commonStore.modelSourceManifestList} onChange={(e, data) => commonStore.setModelSourceManifestList(data.value)} /> +
+ {tags.map(tag => +
+ +
) + } +