Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# (未来会引入更多模块,这里先写占位版)
|
| 4 |
+
|
| 5 |
+
def placeholder_fn(*args, **kwargs):
|
| 6 |
+
return "功能尚未实现,请等待后续更新。"
|
| 7 |
+
|
| 8 |
+
with gr.Blocks() as demo:
|
| 9 |
+
gr.Markdown("# Intelligent Learning Assistant v2.0\n— 大学生专业课学习助手 —")
|
| 10 |
+
|
| 11 |
+
with gr.Tabs():
|
| 12 |
+
with gr.TabItem("智能问答"):
|
| 13 |
+
gr.Markdown("(多轮对话模块,待开发)")
|
| 14 |
+
chat = gr.Chatbot()
|
| 15 |
+
user_msg = gr.Textbox(placeholder="在此输入您的学习问题")
|
| 16 |
+
send_button = gr.Button("发送")
|
| 17 |
+
send_button.click(fn=placeholder_fn, inputs=user_msg, outputs=chat)
|
| 18 |
+
|
| 19 |
+
with gr.TabItem("生成学习大纲"):
|
| 20 |
+
gr.Markdown("(学习大纲生成功能,待开发)")
|
| 21 |
+
topic_input = gr.Textbox(label="主题/章节名称", placeholder="如:线性代数 第五章 特征值与特征向量")
|
| 22 |
+
gen_button = gr.Button("生成大纲")
|
| 23 |
+
gen_button.click(fn=placeholder_fn, inputs=topic_input, outputs=topic_input)
|
| 24 |
+
|
| 25 |
+
with gr.TabItem("自动出题"):
|
| 26 |
+
gr.Markdown("(练习题生成功能,待开发)")
|
| 27 |
+
topic2 = gr.Textbox(label="知识点/主题", placeholder="如:高数 第三章 多元函数")
|
| 28 |
+
difficulty2 = gr.Dropdown(choices=["简单", "中等", "困难"], label="题目难度")
|
| 29 |
+
count2 = gr.Slider(minimum=1, maximum=10, step=1, label="题目数量")
|
| 30 |
+
gen2_button = gr.Button("开始出题")
|
| 31 |
+
# 先用 topic2 作为占位输出
|
| 32 |
+
gen2_button.click(fn=placeholder_fn, inputs=[topic2, difficulty2, count2], outputs=topic2)
|
| 33 |
+
|
| 34 |
+
with gr.TabItem("答案批改"):
|
| 35 |
+
gr.Markdown("(答案批改功能,待开发)")
|
| 36 |
+
std_ans = gr.Textbox(label="标准答案", lines=5, placeholder="请在此粘贴标准答案")
|
| 37 |
+
user_ans = gr.Textbox(label="您的作答", lines=5, placeholder="请在此输入您的解答")
|
| 38 |
+
grade_button = gr.Button("开始批改")
|
| 39 |
+
# 先用 user_ans 作为占位输出
|
| 40 |
+
grade_button.click(fn=placeholder_fn, inputs=[user_ans, std_ans], outputs=user_ans)
|
| 41 |
+
|
| 42 |
+
gr.Markdown("---\nPowered by HuggingFace • v2.0")
|
| 43 |
+
|
| 44 |
+
if __name__ == "__main__":
|
| 45 |
+
demo.launch()
|