Spaces:
Runtime error
Runtime error
weiwei1392
commited on
Commit
·
44ec37f
1
Parent(s):
aed3322
更新依赖
Browse files- __pycache__/llm.cpython-39.pyc +0 -0
- app.py +11 -10
- requirements.txt +1 -0
__pycache__/llm.cpython-39.pyc
CHANGED
|
Binary files a/__pycache__/llm.cpython-39.pyc and b/__pycache__/llm.cpython-39.pyc differ
|
|
|
app.py
CHANGED
|
@@ -71,8 +71,9 @@ def generate_mock_data(_topic, _stand_file_path, _rewrite_prompt, _generate_num,
|
|
| 71 |
return _chatbot, scores_and_comments, stand_file, gr.update(visible=True), gr.update(visible=True)
|
| 72 |
|
| 73 |
except Exception as e:
|
| 74 |
-
|
| 75 |
-
|
|
|
|
| 76 |
gr.update(visible=False)
|
| 77 |
|
| 78 |
|
|
@@ -80,9 +81,9 @@ def rewrite(standard_file, rewrite_prompt, topic, assessments, chatbot):
|
|
| 80 |
try:
|
| 81 |
rewrite_comment = medium_score_rewrite(standard_file, rewrite_prompt, topic, assessments)
|
| 82 |
rewrite_comment = generate_comment_post_process(rewrite_comment)
|
| 83 |
-
message = '
|
| 84 |
except Exception as e:
|
| 85 |
-
message = e
|
| 86 |
chatbot = chatbot + [[None, message]]
|
| 87 |
return chatbot
|
| 88 |
|
|
@@ -91,9 +92,9 @@ def summary(summary_prompt, assessments, chatbot):
|
|
| 91 |
try:
|
| 92 |
summary_comment = quantile_summary(summary_prompt, assessments)
|
| 93 |
summary_comment = generate_comment_post_process(summary_comment)
|
| 94 |
-
message = '
|
| 95 |
except Exception as e:
|
| 96 |
-
message = e
|
| 97 |
chatbot = chatbot + [[None, message]]
|
| 98 |
return chatbot
|
| 99 |
|
|
@@ -115,14 +116,14 @@ with gr.Blocks(css=block_css) as demo:
|
|
| 115 |
# model_name.change(fn=llm_change, inputs=[model_name], outputs=[llm])
|
| 116 |
stand_file_path = gr.Textbox('指标评价标准.xlsx', label='请输入评价标准文件路径')
|
| 117 |
stand_comment = gr.DataFrame(visible=False)
|
| 118 |
-
r_prompt = """
|
| 119 |
<{stand_comment}>
|
| 120 |
"""
|
| 121 |
r_prompt = gr.Text(value=r_prompt, label='请配置改写prompt', lines=3)
|
| 122 |
|
| 123 |
s_prompt = """尖括号里面的内容是多位老师对某堂课的教学评价,每位老师的评价用换行符进行了分隔,请对各位老师的评价进行摘要总结
|
| 124 |
-
|
| 125 |
-
|
| 126 |
s_prompt = gr.Text(value=s_prompt, label='请配置摘要prompt', lines=3)
|
| 127 |
with gr.Row():
|
| 128 |
with gr.Column(scale=2):
|
|
@@ -138,7 +139,7 @@ with gr.Blocks(css=block_css) as demo:
|
|
| 138 |
topic = gr.Textbox('升华和凝华', label='请输入讲课主题')
|
| 139 |
|
| 140 |
# data_out_path = gr.Textbox('', label='请输入模拟数据导出路径')
|
| 141 |
-
generate_num = gr.Slider(1,
|
| 142 |
mock_data = gr.Json(visible=False)
|
| 143 |
|
| 144 |
with gr.Row():
|
|
|
|
| 71 |
return _chatbot, scores_and_comments, stand_file, gr.update(visible=True), gr.update(visible=True)
|
| 72 |
|
| 73 |
except Exception as e:
|
| 74 |
+
message = '模拟测评生成失败,原因是:' + str(e) + '\n\n'
|
| 75 |
+
_chatbot = _chatbot + [[None, message]]
|
| 76 |
+
return _chatbot, dict(), pd.DataFrame(), gr.update(visible=False), \
|
| 77 |
gr.update(visible=False)
|
| 78 |
|
| 79 |
|
|
|
|
| 81 |
try:
|
| 82 |
rewrite_comment = medium_score_rewrite(standard_file, rewrite_prompt, topic, assessments)
|
| 83 |
rewrite_comment = generate_comment_post_process(rewrite_comment)
|
| 84 |
+
message = '上述评价按照中位法改写结果如下:\n\n' + rewrite_comment
|
| 85 |
except Exception as e:
|
| 86 |
+
message = '中位法改写失败,原因是:' + str(e) + '\n\n'
|
| 87 |
chatbot = chatbot + [[None, message]]
|
| 88 |
return chatbot
|
| 89 |
|
|
|
|
| 92 |
try:
|
| 93 |
summary_comment = quantile_summary(summary_prompt, assessments)
|
| 94 |
summary_comment = generate_comment_post_process(summary_comment)
|
| 95 |
+
message = '上述评价按照四分位法摘要结果如下:\n\n' + summary_comment
|
| 96 |
except Exception as e:
|
| 97 |
+
message = '四分位法摘要生成失败,原因是:' + str(e) + '\n\n'
|
| 98 |
chatbot = chatbot + [[None, message]]
|
| 99 |
return chatbot
|
| 100 |
|
|
|
|
| 116 |
# model_name.change(fn=llm_change, inputs=[model_name], outputs=[llm])
|
| 117 |
stand_file_path = gr.Textbox('指标评价标准.xlsx', label='请输入评价标准文件路径')
|
| 118 |
stand_comment = gr.DataFrame(visible=False)
|
| 119 |
+
r_prompt = """The content within the angle brackets is an evaluation of the instructional design regarding the {topic} knowledge point. However, the evaluation does not incorporate the {topic} theme. Please modify the evaluation by incorporating the {topic} theme in each sentence while maintaining the same evaluative perspective and positive/negative nature. The modified evaluation should appear to be specifically targeted towards the {topic} theme.
|
| 120 |
<{stand_comment}>
|
| 121 |
"""
|
| 122 |
r_prompt = gr.Text(value=r_prompt, label='请配置改写prompt', lines=3)
|
| 123 |
|
| 124 |
s_prompt = """尖括号里面的内容是多位老师对某堂课的教学评价,每位老师的评价用换行符进行了分隔,请对各位老师的评价进行摘要总结
|
| 125 |
+
'<{comment}>'
|
| 126 |
+
"""
|
| 127 |
s_prompt = gr.Text(value=s_prompt, label='请配置摘要prompt', lines=3)
|
| 128 |
with gr.Row():
|
| 129 |
with gr.Column(scale=2):
|
|
|
|
| 139 |
topic = gr.Textbox('升华和凝华', label='请输入讲课主题')
|
| 140 |
|
| 141 |
# data_out_path = gr.Textbox('', label='请输入模拟数据导出路径')
|
| 142 |
+
generate_num = gr.Slider(1, 20, value=3, step=1, label="评课人数量", interactive=True)
|
| 143 |
mock_data = gr.Json(visible=False)
|
| 144 |
|
| 145 |
with gr.Row():
|
requirements.txt
CHANGED
|
@@ -2,3 +2,4 @@ requests~=2.28.2
|
|
| 2 |
pandas~=1.5.3
|
| 3 |
gradio~=3.27.0
|
| 4 |
numpy~=1.22.3
|
|
|
|
|
|
| 2 |
pandas~=1.5.3
|
| 3 |
gradio~=3.27.0
|
| 4 |
numpy~=1.22.3
|
| 5 |
+
openpyxl
|