Spaces:
Runtime error
Runtime error
zwq2018
commited on
Commit
·
2ce6486
1
Parent(s):
54aa51a
add chinese fonts
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ css = """#col-container {max-width: 90%; margin-left: auto; margin-right: auto;
|
|
| 24 |
|
| 25 |
# plt.rcParams['font.sans-serif'] = ['WenQuanYi Zen Hei', 'Noto Sans CJK']
|
| 26 |
# plt.rcParams['axes.unicode_minus'] = False
|
| 27 |
-
|
| 28 |
|
| 29 |
example_stock =['给我画一下可孚医疗2022年年中到今天的股价','北向资金今年的每日流入和累计流入','看一下近三年宁德时代和贵州茅台的pb变化','画一下五粮液和泸州老窖从2019年年初到2022年年中的收益率走势','成都银行近一年的k线图和kdj指标','比较下沪深300,创业板指,中证1000指数今年的收益率','今年上证50所有成分股的收益率是多少']
|
| 30 |
example_economic =['中国过去十年的cpi走势是什么','过去五年中国的货币供应量走势,并且打印保存','我想看看现在的新闻或者最新的消息','我想看看中国近十年gdp的走势','预测中国未来12个季度的GDP增速']
|
|
|
|
| 24 |
|
| 25 |
# plt.rcParams['font.sans-serif'] = ['WenQuanYi Zen Hei', 'Noto Sans CJK']
|
| 26 |
# plt.rcParams['axes.unicode_minus'] = False
|
| 27 |
+
plt.rcParams['font.family'] = 'SimHei'
|
| 28 |
|
| 29 |
example_stock =['给我画一下可孚医疗2022年年中到今天的股价','北向资金今年的每日流入和累计流入','看一下近三年宁德时代和贵州茅台的pb变化','画一下五粮液和泸州老窖从2019年年初到2022年年中的收益率走势','成都银行近一年的k线图和kdj指标','比较下沪深300,创业板指,中证1000指数今年的收益率','今年上证50所有成分股的收益率是多少']
|
| 30 |
example_economic =['中国过去十年的cpi走势是什么','过去五年中国的货币供应量走势,并且打印保存','我想看看现在的新闻或者最新的消息','我想看看中国近十年gdp的走势','预测中国未来12个季度的GDP增速']
|
main.py
CHANGED
|
@@ -17,8 +17,8 @@ from io import BytesIO
|
|
| 17 |
import queue
|
| 18 |
import datetime
|
| 19 |
from threading import Thread
|
| 20 |
-
plt.rcParams['font.family'] = 'Times New Roman'
|
| 21 |
-
plt.rcParams['axes.unicode_minus'] = False
|
| 22 |
import openai
|
| 23 |
# 设置plt的字体
|
| 24 |
|
|
@@ -26,7 +26,7 @@ import openai
|
|
| 26 |
|
| 27 |
|
| 28 |
font_path = './fonts/SimHei.ttf'
|
| 29 |
-
font_prop = fm.FontProperties(font_path)
|
| 30 |
# To override the Thread method
|
| 31 |
class MyThread(Thread):
|
| 32 |
|
|
@@ -353,7 +353,7 @@ def run(instruction, add_to_queue=None, send_chat_request_Azure = send_official_
|
|
| 353 |
|
| 354 |
print(output_result)
|
| 355 |
buf = BytesIO()
|
| 356 |
-
plt.savefig(buf, format='png', fontproperties=font_prop)
|
| 357 |
buf.seek(0)
|
| 358 |
#
|
| 359 |
#
|
|
|
|
| 17 |
import queue
|
| 18 |
import datetime
|
| 19 |
from threading import Thread
|
| 20 |
+
# plt.rcParams['font.family'] = 'Times New Roman'
|
| 21 |
+
# plt.rcParams['axes.unicode_minus'] = False
|
| 22 |
import openai
|
| 23 |
# 设置plt的字体
|
| 24 |
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
font_path = './fonts/SimHei.ttf'
|
| 29 |
+
font_prop = fm.FontProperties(fname= font_path)
|
| 30 |
# To override the Thread method
|
| 31 |
class MyThread(Thread):
|
| 32 |
|
|
|
|
| 353 |
|
| 354 |
print(output_result)
|
| 355 |
buf = BytesIO()
|
| 356 |
+
plt.savefig(buf, format='png', fontproperties=font_prop, dpi=300)
|
| 357 |
buf.seek(0)
|
| 358 |
#
|
| 359 |
#
|
tool.py
CHANGED
|
@@ -23,7 +23,7 @@ from sklearn.linear_model import LinearRegression
|
|
| 23 |
|
| 24 |
|
| 25 |
font_path = './fonts/SimHei.ttf'
|
| 26 |
-
font_prop = fm.FontProperties(font_path)
|
| 27 |
|
| 28 |
|
| 29 |
tushare_token = os.getenv('TUSHARE_TOKEN')
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
font_path = './fonts/SimHei.ttf'
|
| 26 |
+
font_prop = fm.FontProperties(fname=font_path)
|
| 27 |
|
| 28 |
|
| 29 |
tushare_token = os.getenv('TUSHARE_TOKEN')
|