Siyuan0730 commited on
Commit
075a3b2
·
1 Parent(s): 7c0eb81

改进description

Browse files
Files changed (1) hide show
  1. app.py +45 -21
app.py CHANGED
@@ -291,17 +291,21 @@ def regenerate_content(course_content_list):
291
 
292
  def app():
293
  st.title("OmniTutor v0.1.0")
294
- description1 = st.markdown('''
295
- <font color = grey> An all-round teacher. A teaching assistant who really knows the subject </font>
296
- <font color = grey> Anything. Anywhere. All at once. </font>
297
- ''')
298
- divider = st.divider()
299
- description2 = st.markdown('''
300
- <font color = grey> 👈 Upload learning materials in the sidebar, and touch "submit" button </font>
301
- <font color = grey> 🎉 Ready to see what happens.. </font>
302
-
303
- '''
304
- )
 
 
 
 
305
  with st.sidebar:
306
  st.image("https://siyuan-harry.oss-cn-beijing.aliyuncs.com/oss://siyuan-harry/20231021212525.png")
307
  added_files = st.file_uploader('Upload .md and .pdf files, simultaneous mixed upload these types is supported.', type=['.md','.pdf'], accept_multiple_files=True)
@@ -312,25 +316,47 @@ def app():
312
  language = 'Chinese'
313
  btn = st.button('submit')
314
 
 
 
 
 
 
 
315
  if "embeddings_df" not in st.session_state:
316
- st.session_state.embeddings_df = 1
317
  if "faiss_index" not in st.session_state:
318
- st.session_state.faiss_index = 1
319
  if "course_outline_list" not in st.session_state:
320
- st.session_state.course_outline_list = 1
321
  if "course_content_list" not in st.session_state:
322
- st.session_state.course_content_list = 1
323
  if "openai_model" not in st.session_state:
324
  st.session_state["openai_model"] = "gpt-3.5-turbo"
325
  # Initialize chat history
326
  if "messages" not in st.session_state:
327
  st.session_state.messages = []
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  if btn:
330
- description1.empty()
331
- divider.empty()
332
- description2.empty()
333
-
334
  #initialize app
335
  temp_file_paths = initialize_file(added_files)
336
  st.session_state.embeddings_df, st.session_state.faiss_index = initialize_vdb(temp_file_paths)
@@ -338,8 +364,6 @@ def app():
338
  st.session_state.course_content_list = initialize_content(st.session_state.course_outline_list, st.session_state.embeddings_df, st.session_state.faiss_index, language)
339
 
340
  col1, col2 = st.columns([0.6,0.4])
341
-
342
- # 这里还可以设置col1 和 col2 不同时出现 - 需要拆分initialize_app()函数
343
 
344
  user_question = st.chat_input("Enter your questions when learning...")
345
 
 
291
 
292
  def app():
293
  st.title("OmniTutor v0.1.0")
294
+ st.markdown("""
295
+ <style>
296
+ .footer {
297
+ position: fixed;
298
+ bottom: 0;
299
+ left: 10px;
300
+ width: auto;
301
+ background-color: transparent;
302
+ text-align: right;
303
+ padding-right: 10px;
304
+ padding-bottom: 10px;
305
+ }
306
+ </style>
307
+ <div class="footer">Made with ❤️ by Siyuan</div>
308
+ """, unsafe_allow_html=True)
309
  with st.sidebar:
310
  st.image("https://siyuan-harry.oss-cn-beijing.aliyuncs.com/oss://siyuan-harry/20231021212525.png")
311
  added_files = st.file_uploader('Upload .md and .pdf files, simultaneous mixed upload these types is supported.', type=['.md','.pdf'], accept_multiple_files=True)
 
316
  language = 'Chinese'
317
  btn = st.button('submit')
318
 
319
+ if "description1" not in st.session_state:
320
+ st.session_state.description1 = ''
321
+ if "divider" not in st.session_state:
322
+ st.session_state.divider = ''
323
+ if "description2" not in st.session_state:
324
+ st.session_state.description2 = ''
325
  if "embeddings_df" not in st.session_state:
326
+ st.session_state.embeddings_df = ''
327
  if "faiss_index" not in st.session_state:
328
+ st.session_state.faiss_index = ''
329
  if "course_outline_list" not in st.session_state:
330
+ st.session_state.course_outline_list = ''
331
  if "course_content_list" not in st.session_state:
332
+ st.session_state.course_content_list = ''
333
  if "openai_model" not in st.session_state:
334
  st.session_state["openai_model"] = "gpt-3.5-turbo"
335
  # Initialize chat history
336
  if "messages" not in st.session_state:
337
  st.session_state.messages = []
338
 
339
+
340
+ st.session_state.description1 = st.markdown('''
341
+ :grey[An all-round teacher. A teaching assistant who really knows the subject]
342
+
343
+ :grey[Anything. Anywhere. All at once. ]
344
+ ''')
345
+ st.session_state.divider = st.divider()
346
+ st.session_state.description2 = st.markdown('''
347
+ <font color = grey> 👈 Upload learning materials in the sidebar, and touch "submit" button </font>
348
+
349
+ <font color = grey> 🎉 Ready to see what happens.. </font>
350
+
351
+ ''', unsafe_allow_html=True
352
+ )
353
+
354
+
355
  if btn:
356
+ st.session_state.description1.empty()
357
+ st.session_state.divider.empty()
358
+ st.session_state.description2.empty()
359
+
360
  #initialize app
361
  temp_file_paths = initialize_file(added_files)
362
  st.session_state.embeddings_df, st.session_state.faiss_index = initialize_vdb(temp_file_paths)
 
364
  st.session_state.course_content_list = initialize_content(st.session_state.course_outline_list, st.session_state.embeddings_df, st.session_state.faiss_index, language)
365
 
366
  col1, col2 = st.columns([0.6,0.4])
 
 
367
 
368
  user_question = st.chat_input("Enter your questions when learning...")
369