Spaces:
Running
Running
Commit
·
98e9f16
1
Parent(s):
70cafa7
修改代码,让btn的点击之后的加载,从col1中解放出来
Browse files
app.py
CHANGED
@@ -215,41 +215,42 @@ def app():
|
|
215 |
Chinese = st.checkbox('Output in Chinese')
|
216 |
if Chinese:
|
217 |
language = 'Chinese'
|
218 |
-
|
219 |
|
220 |
|
221 |
col1, col2 = st.columns([0.6,0.4], gap='large')
|
222 |
-
|
223 |
-
with col1:
|
224 |
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
|
|
|
|
246 |
with st.expander("Check the course outline", expanded=False):
|
247 |
st.write(course_outline_string)
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
253 |
count_generating_content = 0
|
254 |
for lesson in course_outline_list:
|
255 |
count_generating_content += 1
|
|
|
215 |
Chinese = st.checkbox('Output in Chinese')
|
216 |
if Chinese:
|
217 |
language = 'Chinese'
|
218 |
+
btn = st.button('submit')
|
219 |
|
220 |
|
221 |
col1, col2 = st.columns([0.6,0.4], gap='large')
|
|
|
|
|
222 |
|
223 |
+
if btn:
|
224 |
+
temp_file_paths = []
|
225 |
+
col1.file_proc_state = st.text("Processing file...")
|
226 |
+
for added_file in added_files:
|
227 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".md") as tmp:
|
228 |
+
tmp.write(added_file.getvalue())
|
229 |
+
tmp_path = tmp.name
|
230 |
+
temp_file_paths.append(tmp_path)
|
231 |
+
col1.file_proc_state.text("Processing file...Done")
|
232 |
+
|
233 |
+
col1.outline_generating_state = st.text("Generating Course Oueline...")
|
234 |
+
course_outline_list = courseOutlineGenerating(temp_file_paths, num_lessons, language)
|
235 |
+
col1.outline_generating_state.text("Generating Course Oueline...Done")
|
236 |
+
|
237 |
+
#把课程大纲打印出来
|
238 |
+
course_outline_string = ''
|
239 |
+
lessons_count = 0
|
240 |
+
for outline in course_outline_list:
|
241 |
+
lessons_count += 1
|
242 |
+
course_outline_string += f"{lessons_count}." + outline[0] + '\n'
|
243 |
+
course_outline_string += '\n' + outline[1] + '\n\n'
|
244 |
+
#time.sleep(1)
|
245 |
+
with col1:
|
246 |
with st.expander("Check the course outline", expanded=False):
|
247 |
st.write(course_outline_string)
|
248 |
|
249 |
+
col1.vdb_state = st.text("Constructing vector database from provided materials...")
|
250 |
+
embeddings_df, faiss_index = constructVDB(temp_file_paths)
|
251 |
+
col1.vdb_state.text("Constructing vector database from provided materials...Done")
|
252 |
+
|
253 |
+
with col1:
|
254 |
count_generating_content = 0
|
255 |
for lesson in course_outline_list:
|
256 |
count_generating_content += 1
|