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