allinaigc commited on
Commit
c19b9f3
·
1 Parent(s): bbe57d8

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -24
app.py CHANGED
@@ -119,7 +119,7 @@ async def main():
119
  sns.set_style('whitegrid',{'font.sans-serif':['simhei','Arial']})
120
  -------------------------------------------------------------------------
121
  """ ## seaborn中的palette参数可以设定图表的颜色,选项包括:deep, muted, pastel, bright, dark, colorblind,Spectral。更多参数可以参考:https://seaborn.pydata.org/generated/seaborn.color_palette.html。
122
- # myfont=FontProperties(fname='SimHei.ttf')
123
  # sns.set_style('whitegrid',{'font.sans-serif': ['simhei','Arial']})
124
  # print('now font is:', myfont)
125
 
@@ -129,29 +129,31 @@ async def main():
129
  ### 加载上传的文件,主要路径在上面代码中。
130
  files = [File.from_path(str(uploaded_file_path))]
131
 
132
- ### generate the response
133
- response = await session.generate_response(
134
- user_request, files=files
135
- )
136
-
137
- # output to the user
138
- print("AI: ", response.content)
139
- full_response = response.content
140
- ### full_response = "this is full response"
141
-
142
- # for file in response.files:
143
- for i, file in enumerate(response.files):
144
- # await file.asave(f"/Users/yunshi/Downloads/360Data/Data Center/Working-On Task/演讲与培训/2023ChatGPT/Coding/code_interpreter/output{i}.png") ##working.
145
- # st.image(file.get_image() #! working.
146
- # file.show_image()
147
- # st.image(file.get_image(), width=500, output_format='png')
148
- st.image(file.get_image(), width=None, output_format='PNG') #* 注意这里的设定,可以提高图片的精细程度。
149
-
150
-
151
- # message_placeholder.markdown(full_response + "▌") ## orignal code.
152
- # message_placeholder.markdown(full_response) ## orignal code.
153
- st.write(full_response)
154
- await session.astop() #! 确认需要关闭。
 
 
155
 
156
  st.session_state.messages.append(
157
  {"role": "assistant", "content": full_response})
 
119
  sns.set_style('whitegrid',{'font.sans-serif':['simhei','Arial']})
120
  -------------------------------------------------------------------------
121
  """ ## seaborn中的palette参数可以设定图表的颜色,选项包括:deep, muted, pastel, bright, dark, colorblind,Spectral。更多参数可以参考:https://seaborn.pydata.org/generated/seaborn.color_palette.html。
122
+ myfont=FontProperties(fname='SimHei.ttf')
123
  # sns.set_style('whitegrid',{'font.sans-serif': ['simhei','Arial']})
124
  # print('now font is:', myfont)
125
 
 
129
  ### 加载上传的文件,主要路径在上面代码中。
130
  files = [File.from_path(str(uploaded_file_path))]
131
 
132
+
133
+ with st.status('processing...', expanded=True,state='running'):
134
+ ### generate the response
135
+ response = await session.generate_response(
136
+ user_request, files=files
137
+ )
138
+
139
+ # output to the user
140
+ print("AI: ", response.content)
141
+ full_response = response.content
142
+ ### full_response = "this is full response"
143
+
144
+ # for file in response.files:
145
+ for i, file in enumerate(response.files):
146
+ # await file.asave(f"/Users/yunshi/Downloads/360Data/Data Center/Working-On Task/演讲与培训/2023ChatGPT/Coding/code_interpreter/output{i}.png") ##working.
147
+ # st.image(file.get_image() #! working.
148
+ # file.show_image()
149
+ # st.image(file.get_image(), width=500, output_format='png')
150
+ st.image(file.get_image(), width=None, output_format='PNG') #* 注意这里的设定,可以提高图片的精细程度。
151
+
152
+
153
+ # message_placeholder.markdown(full_response + "▌") ## orignal code.
154
+ # message_placeholder.markdown(full_response) ## orignal code.
155
+ st.write(full_response)
156
+ await session.astop() #! 确认需要关闭。
157
 
158
  st.session_state.messages.append(
159
  {"role": "assistant", "content": full_response})