Upload app.py
Browse files
app.py
CHANGED
@@ -129,13 +129,7 @@ async def main():
|
|
129 |
-------------------------------------------------------------------------
|
130 |
1. 你需要用提问的语言来回答(如:中文提问你就用中文来回答,英文提问你就用英文来回答)。
|
131 |
2. 如果要求你输出图表,那么图的解析度dpi需要设定为600。图尽量使用seaborn库。seaborn库的参数设定:sns.set(rc={'axes.facecolor':'#FFF9ED','figure.facecolor':'#FFF9ED'}, palette='deep', font='myfont')。
|
132 |
-
3. 你需要在matplotlib中安装根目录下的[
|
133 |
-
4. 你需要加入如下代码,可以用来解决中文显示问题:
|
134 |
-
from matplotlib.font_manager import FontProperties
|
135 |
-
myfont = FontProperties(fname='SimHei.ttf') # NOTE: 字体在本目录下。
|
136 |
-
sns.set(font='myfont')
|
137 |
-
plt.title(fontproperties='myfont')
|
138 |
-
|
139 |
-------------------------------------------------------------------------
|
140 |
""" # seaborn中的palette参数可以设定图表的颜色,选项包括:deep, muted, pastel, bright, dark, colorblind,Spectral。更多参数可以参考:https://seaborn.pydata.org/generated/seaborn.color_palette.html。
|
141 |
|
@@ -151,6 +145,9 @@ async def main():
|
|
151 |
with st.status('processing...', expanded=True, state='running') as status:
|
152 |
# sns.set(font='myfont')
|
153 |
# generate the response
|
|
|
|
|
|
|
154 |
response = await session.generate_response(
|
155 |
user_request, files=files
|
156 |
)
|
|
|
129 |
-------------------------------------------------------------------------
|
130 |
1. 你需要用提问的语言来回答(如:中文提问你就用中文来回答,英文提问你就用英文来回答)。
|
131 |
2. 如果要求你输出图表,那么图的解析度dpi需要设定为600。图尽量使用seaborn库。seaborn库的参数设定:sns.set(rc={'axes.facecolor':'#FFF9ED','figure.facecolor':'#FFF9ED'}, palette='deep', font='myfont')。
|
132 |
+
3. 你需要在matplotlib中安装根目录下的[SimHei.ttf]字库,然后把图上的文字转换成[SimHei.ttf]来显示。
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
-------------------------------------------------------------------------
|
134 |
""" # seaborn中的palette参数可以设定图表的颜色,选项包括:deep, muted, pastel, bright, dark, colorblind,Spectral。更多参数可以参考:https://seaborn.pydata.org/generated/seaborn.color_palette.html。
|
135 |
|
|
|
145 |
with st.status('processing...', expanded=True, state='running') as status:
|
146 |
# sns.set(font='myfont')
|
147 |
# generate the response
|
148 |
+
myfont = FontProperties(fname='SimHei.ttf') # NOTE: 注意这里的云服务器路径格式。
|
149 |
+
plt.title("这个是数据分布图", fontsize=12, fontproperties=myfont)
|
150 |
+
|
151 |
response = await session.generate_response(
|
152 |
user_request, files=files
|
153 |
)
|