Skip to content

Commit

Permalink
统计
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldWaterFall committed Jan 30, 2024
1 parent c3a9865 commit 09aad28
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
10 changes: 4 additions & 6 deletions .ci/gpt_prompt_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

all_gpt_json_path = os.environ.get('all_gpt_json')

#all_gpt_json_path=r'C:\Users\yhd\PycharmProjects\TianjiOrignal\tianji\prompt\gpt_prompt\all_gpt_prompt.json'
# 打开 JSON 文本文件并加载数据
with open(all_gpt_json_path, 'r', encoding='utf-8') as file:
data = json.load(file)
Expand Down Expand Up @@ -44,13 +44,11 @@
# 将 ID 转换为整数索引
id_indices = list(range(len(ids)))

# 设置字体为微软雅黑
plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']

# 绘制柱状图
plt.bar(id_indices, counts)
plt.xlabel('分类') # 修改横坐标标签
plt.ylabel('有效Prompt个数')
plt.xlabel('Category') # 修改横坐标标签
plt.ylabel('Number of valid prompts')

# 旋转横坐标标签,以避免重叠
plt.xticks(id_indices, labels, rotation=45, ha='right')
Expand All @@ -59,7 +57,7 @@
for i, count in enumerate(counts):
plt.text(id_indices[i], count, str(count), ha='center', va='bottom')

plt.title('gpt Prompt 统计')
plt.title('gpt prompt statistics')

# 保存为 PNG 图片文件
plt.savefig('gpt_prompt_statistics.png', bbox_inches='tight')
Expand Down
Binary file added .ci/gpt_prompt_statistics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions .ci/yiyan_prompt_stat.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import json
import matplotlib.pyplot as plt
import os
all_yiyan_json_path = os.environ.get('all_yiyan_json')

#all_yiyan_json_path = os.environ.get('all_yiyan_json')
all_yiyan_json_path=r'C:\Users\yhd\PycharmProjects\TianjiOrignal\tianji\prompt\yiyan_prompt\all_yiyan_prompt.json'
# 打开 JSON 文本文件并加载数据
with open(all_yiyan_json_path, 'r', encoding='utf-8') as file:
data = json.load(file)
Expand Down Expand Up @@ -43,13 +44,12 @@
# 将 ID 转换为整数索引
id_indices = list(range(len(ids)))

# 设置字体为微软雅黑
plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']


# 绘制柱状图
plt.bar(id_indices, counts)
plt.xlabel('分类') # 修改横坐标标签
plt.ylabel('有效Prompt个数')
plt.xlabel('Category') # 修改横坐标标签
plt.ylabel('Number of valid prompts')

# 旋转横坐标标签,以避免重叠
plt.xticks(id_indices, labels, rotation=45, ha='right')
Expand All @@ -58,7 +58,7 @@
for i, count in enumerate(counts):
plt.text(id_indices[i], count, str(count), ha='center', va='bottom')

plt.title('yiyan Prompt 统计')
plt.title('yiyan prompt statistics')

# 保存为 PNG 图片文件
plt.savefig('yiyan_prompt_statistics.png', bbox_inches='tight')
Expand Down
Binary file added .ci/yiyan_prompt_statistics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 11 additions & 7 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,23 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install matplotlib
- name: Install Microsoft YaHei Font
run: |
sudo apt-get update
sudo apt-get install -y ttf-mscorefonts-installer
- name: Count the number of gpt prompts
env:
all_gpt_json: 'tianji/prompt/gpt_prompt/all_gpt_prompt.json'
run : python .ci/gpt_prompt_stat.py

mv gpt_prompt_statistics.png .ci/gpt_prompt_statistics.png
uses: actions/upload-artifact@v2
with:
name: gpt_prompt_statistics # 工件的名称,您可以根据需要命名
path: .ci/gpt_prompt_statistics.png # 指定生成的 PNG 文件的路径

- name: Count the number of yiyan prompts
env:
all_yiyan_json: 'tianji/prompt/yiyan_prompt/all_yiyan_prompt.json'
run : python .ci/yiyan_prompt_stat.py
run : python .ci/yiyan_prompt_stat.py
mv yiyan_prompt_statistics.png .ci/yiyan_prompt_statistics.png
uses: actions/upload-artifact@v2
with:
name: yiyan_prompt_statistics # 工件的名称,您可以根据需要命名
path: .ci/yiyan_prompt_statistics.png # 指定生成的 PNG 文件的路径

0 comments on commit 09aad28

Please sign in to comment.