Spaces:
Sleeping
Sleeping
Commit
·
ecf88a0
1
Parent(s):
36e4ec1
同步git上的代码
Browse files
app.py
CHANGED
@@ -70,7 +70,6 @@ def get_completion_from_messages(messages, model="gpt-4", temperature=0):
|
|
70 |
)
|
71 |
return response.choices[0].message["content"]
|
72 |
|
73 |
-
#调用gpt API生成课程大纲 + 每节课解释,随后输出为md文档。并在课程内一直保留着
|
74 |
def genarating_outline(keywords, num_lessons,language):
|
75 |
system_message = 'You are a great AI teacher and linguist, skilled at create course outline based on summarized knowledge materials.'
|
76 |
user_message = f"""You are a great AI teacher and linguist,
|
@@ -262,7 +261,6 @@ def initialize_content(course_outline_list, embeddings_df, faiss_index, language
|
|
262 |
st.success(f"Writing content for lesson {count_generating_content}...Done")
|
263 |
with st.expander(f"Learn the lesson {count_generating_content} ", expanded=False):
|
264 |
st.markdown(courseContent)
|
265 |
-
|
266 |
return course_content_list
|
267 |
|
268 |
def regenerate_outline(course_outline_list):
|
@@ -338,16 +336,13 @@ def app():
|
|
338 |
btn = st.button('Generate my course!')
|
339 |
|
340 |
if "description1" not in st.session_state:
|
341 |
-
st.session_state.
|
342 |
-
if "divider" not in st.session_state:
|
343 |
-
st.session_state.divider = ''
|
344 |
-
if "description2" not in st.session_state:
|
345 |
-
st.session_state.description2 = ''
|
346 |
if "start_col1" not in st.session_state:
|
347 |
st.session_state.start_col1 = st.empty()
|
348 |
if "start_col2" not in st.session_state:
|
349 |
st.session_state.start_col2 = st.empty()
|
350 |
-
|
|
|
351 |
|
352 |
if "embeddings_df" not in st.session_state:
|
353 |
st.session_state.embeddings_df = ''
|
@@ -368,31 +363,73 @@ def app():
|
|
368 |
st.session_state.start_col1, st.session_state.start_col2 = st.columns(2)
|
369 |
|
370 |
with st.session_state.start_col1:
|
371 |
-
st.session_state.
|
372 |
> <font color = 'grey'> An all-round teacher. A teaching assistant who really knows the subject </font>
|
373 |
-
>
|
374 |
> <font color = 'grey'> Anything. Anywhere. All at once. </font> :100:
|
375 |
>
|
376 |
> Github Repo: https://github.com/Siyuan-Harry/OmniTutor
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
|
383 |
-
🎉
|
384 |
-
'''
|
385 |
)
|
386 |
with st.session_state.start_col2:
|
387 |
-
st.markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
|
389 |
|
390 |
if btn:
|
391 |
-
st.session_state.description1.empty()
|
392 |
-
st.session_state.divider.empty()
|
393 |
-
st.session_state.description2.empty()
|
394 |
st.session_state.start_col1.empty()
|
395 |
st.session_state.start_col2.empty()
|
|
|
|
|
396 |
|
397 |
#initialize app
|
398 |
temp_file_paths = initialize_file(added_files)
|
@@ -413,9 +450,10 @@ def app():
|
|
413 |
user_question = st.chat_input("Enter your questions when learning...")
|
414 |
|
415 |
if user_question:
|
416 |
-
st.session_state.
|
417 |
-
st.session_state.
|
418 |
-
st.session_state.
|
|
|
419 |
|
420 |
with col1:
|
421 |
#把课程大纲打印出来
|
|
|
70 |
)
|
71 |
return response.choices[0].message["content"]
|
72 |
|
|
|
73 |
def genarating_outline(keywords, num_lessons,language):
|
74 |
system_message = 'You are a great AI teacher and linguist, skilled at create course outline based on summarized knowledge materials.'
|
75 |
user_message = f"""You are a great AI teacher and linguist,
|
|
|
261 |
st.success(f"Writing content for lesson {count_generating_content}...Done")
|
262 |
with st.expander(f"Learn the lesson {count_generating_content} ", expanded=False):
|
263 |
st.markdown(courseContent)
|
|
|
264 |
return course_content_list
|
265 |
|
266 |
def regenerate_outline(course_outline_list):
|
|
|
336 |
btn = st.button('Generate my course!')
|
337 |
|
338 |
if "description1" not in st.session_state:
|
339 |
+
st.session_state.description = ''
|
|
|
|
|
|
|
|
|
340 |
if "start_col1" not in st.session_state:
|
341 |
st.session_state.start_col1 = st.empty()
|
342 |
if "start_col2" not in st.session_state:
|
343 |
st.session_state.start_col2 = st.empty()
|
344 |
+
if "case_pay" not in st.session_state:
|
345 |
+
st.session_state.case_pay = st.empty()
|
346 |
|
347 |
if "embeddings_df" not in st.session_state:
|
348 |
st.session_state.embeddings_df = ''
|
|
|
363 |
st.session_state.start_col1, st.session_state.start_col2 = st.columns(2)
|
364 |
|
365 |
with st.session_state.start_col1:
|
366 |
+
st.session_state.description = st.markdown('''
|
367 |
> <font color = 'grey'> An all-round teacher. A teaching assistant who really knows the subject </font>
|
368 |
+
>
|
369 |
> <font color = 'grey'> Anything. Anywhere. All at once. </font> :100:
|
370 |
>
|
371 |
> Github Repo: https://github.com/Siyuan-Harry/OmniTutor
|
372 |
+
|
373 |
+
### ✨ Key features
|
374 |
+
|
375 |
+
- 🧑🏫 **Concise and clear course creation**: <font color = 'grey'>Generated from your learning notes (**.md**) or any learning materials (**.pdf**)!</font>
|
376 |
+
- 📚 **All disciplines**: <font color = 'grey'>Whether it's math, physics, literature, history or coding, OmniTutor covers it all.</font>
|
377 |
+
- ⚙️ **Customize your own course**: <font color = 'grey'>Choose your preferred teaching style, lesson count and language.</font>
|
378 |
+
- ⚡️ **Fast respond with trustable accuracy**: <font color = 'grey'>Problem-solving chat with the AI teaching assistant who really understand the materials.</font>
|
379 |
+
|
380 |
+
### 🏃♂️ Get started!
|
381 |
+
|
382 |
+
1. **Upload learning materials**: <font color = 'grey'>The upload widget in the sidebar supports PDF and .md files simutaenously.</font>
|
383 |
+
2. **Customize your course**: <font color = 'grey'>By few clicks and swipes, adjusting teaching style, lesson count and language for your course.</font>
|
384 |
+
3. **Start course generating**: <font color = 'grey'>Touch "Generate my course!" button in the sidebar, then watch how OmniTutor creates personal-customized course for you.</font>
|
385 |
+
4. **Interactive learning**: <font color = 'grey'>Learn the course, and ask OmniTutor any questions related to this course whenever you encountered them.</font>
|
386 |
|
387 |
+
🎉 Have fun playing with Omnitutor!
|
388 |
+
''', unsafe_allow_html=True
|
389 |
)
|
390 |
with st.session_state.start_col2:
|
391 |
+
st.session_state.case_pay = st.markdown('''
|
392 |
+
### 💡Application Cases 使用案例
|
393 |
+
|
394 |
+
> <font color = 'grey'> 用OmniTutor阅读专业的论文! </font>
|
395 |
+
|
396 |
+
<img src="https://siyuan-harry.oss-cn-beijing.aliyuncs.com/oss://siyuan-harry/WX20231104-122256@2x%2016.03.49.png" height = "300" />
|
397 |
+
|
398 |
+
<img src="https://siyuan-harry.oss-cn-beijing.aliyuncs.com/oss://siyuan-harry/WX20231104-113553@2x%202.png" height = "300" />
|
399 |
+
|
400 |
+
> <font color = 'grey'> 用OmniTutor学习Python! </font>
|
401 |
+
|
402 |
+
<img src="https://siyuan-harry.oss-cn-beijing.aliyuncs.com/oss://siyuan-harry/[email protected]" height = "300" />
|
403 |
+
|
404 |
+
<img src="https://siyuan-harry.oss-cn-beijing.aliyuncs.com/oss://siyuan-harry/[email protected]" height = "300" />
|
405 |
+
|
406 |
+
---
|
407 |
+
|
408 |
+
### 💰 Support by donation 捐款支持
|
409 |
+
|
410 |
+
- 请捐款支持。因为每位用户的每次课程生成,都会产生一定的费用。个人开发者维护不易
|
411 |
+
- Please donate to support. Because each course generated by each user will incur a certain cost for me.
|
412 |
+
|
413 |
+
<img src="https://siyuan-harry.oss-cn-beijing.aliyuncs.com/oss://siyuan-harry/20231110145229.png" height = "260" />
|
414 |
+
|
415 |
+
---
|
416 |
+
|
417 |
+
### 🙌 Contact me 联系我
|
418 |
+
|
419 |
+
欢迎联系开发者 @何思远方Siyuan. Feel free to get in touch with me!
|
420 |
+
|
421 |
+
- 邮箱📮:[email protected]
|
422 |
+
- B站:何思远方Siyuan
|
423 |
+
|
424 |
+
|
425 |
+
''', unsafe_allow_html=True)
|
426 |
|
427 |
|
428 |
if btn:
|
|
|
|
|
|
|
429 |
st.session_state.start_col1.empty()
|
430 |
st.session_state.start_col2.empty()
|
431 |
+
st.session_state.description.empty()
|
432 |
+
st.session_state.case_pay.empty()
|
433 |
|
434 |
#initialize app
|
435 |
temp_file_paths = initialize_file(added_files)
|
|
|
450 |
user_question = st.chat_input("Enter your questions when learning...")
|
451 |
|
452 |
if user_question:
|
453 |
+
st.session_state.start_col1.empty()
|
454 |
+
st.session_state.start_col2.empty()
|
455 |
+
st.session_state.description.empty()
|
456 |
+
st.session_state.case_pay.empty()
|
457 |
|
458 |
with col1:
|
459 |
#把课程大纲打印出来
|