allinaigc commited on
Commit
9737ba3
·
1 Parent(s): 5f5c0d7

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -129,12 +129,9 @@ 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和seaborn图表上的字体需要设置为中文字体,如下:
133
- myfont = FontProperties(fname='YaHei.ttf') # NOTE: 安装在服务器的当前目录下YaHei.ttf。
134
- plt.rcParams['font.sans-serif'] = ['myfont']
135
- plt.rcParams['font.family'] = 'sans-serif'
136
- mpl.rcParams['font.family'] = ['myfont']
137
- sns.set(font='myfont')
138
  -------------------------------------------------------------------------
139
  """ # seaborn中的palette参数可以设定图表的颜色,选项包括:deep, muted, pastel, bright, dark, colorblind,Spectral。更多参数可以参考:https://seaborn.pydata.org/generated/seaborn.color_palette.html。
140
 
@@ -148,7 +145,6 @@ async def main():
148
  files = [File.from_path(str(uploaded_file_path))]
149
 
150
  with st.status('processing...', expanded=True, state='running') as status:
151
- mpl.rcParams['font.family'] = 'myfont'
152
  # sns.set(font='myfont')
153
  # generate the response
154
  response = await session.generate_response(
 
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和seaborn图表上的字体需要设置为中文字体,按如下编写代码:
133
+ a. 在现有的matplotlib/seaborn库中安装黑体字体[SimHei]
134
+ b. 然后在plt和sns中设置fontproperties为黑体字体[SimHei]
 
 
 
135
  -------------------------------------------------------------------------
136
  """ # seaborn中的palette参数可以设定图表的颜色,选项包括:deep, muted, pastel, bright, dark, colorblind,Spectral。更多参数可以参考:https://seaborn.pydata.org/generated/seaborn.color_palette.html。
137
 
 
145
  files = [File.from_path(str(uploaded_file_path))]
146
 
147
  with st.status('processing...', expanded=True, state='running') as status:
 
148
  # sns.set(font='myfont')
149
  # generate the response
150
  response = await session.generate_response(