lanny xu commited on
Commit
87ec2c5
·
1 Parent(s): f8985a7

delete vectara

Browse files
Files changed (1) hide show
  1. kaggle_gradio_app.py +14 -32
kaggle_gradio_app.py CHANGED
@@ -68,53 +68,36 @@ class RAGChatInterface:
68
  return f"❌ 查询失败: {str(e)}"
69
 
70
  def create_interface(self):
71
- """创建Gradio界面"""
72
 
73
- # 自定义CSS样式
74
- custom_css = """
75
- .gradio-container {
76
- font-family: 'Arial', sans-serif;
77
- }
78
- .chatbot {
79
- height: 500px;
80
- }
81
- """
82
-
83
- # 创建聊天界面
84
- with gr.Blocks(css=custom_css, title="🤖 自适应RAG智能问答") as demo:
85
  gr.Markdown(
86
  """
87
  # 🤖 自适应RAG智能问答系统
88
 
89
- 基于LangGraph的自适应检索增强生成系统,支持:
90
- - 🔍 智能路由(本地知识库 vs 网络搜索)
91
- - 📚 混合检索(向量 + BM25)
92
- - 🎯 多重质量控制(文档评分、幻觉检测)
93
- - 🔄 自适应查询重写
94
 
95
  **使用方法**: 在下方输入框输入问题,系统会自动选择最佳检索策略并生成答案。
96
  """
97
  )
98
 
99
- # 聊天界面
100
  chatbot = gr.Chatbot(
101
  label="对话历史",
102
- height=500,
103
- show_label=True,
104
- avatar_images=(None, "🤖")
105
  )
106
 
107
- with gr.Row():
108
- msg = gr.Textbox(
109
- label="输入问题",
110
- placeholder="例如: AlphaCodium论文讲的是什么?",
111
- lines=2,
112
- scale=4
113
- )
114
- submit_btn = gr.Button("🚀 发送", scale=1, variant="primary")
115
 
116
  with gr.Row():
117
- clear_btn = gr.Button("🗑️ 清空对话", scale=1)
 
118
 
119
  # 示例问题
120
  gr.Examples(
@@ -123,7 +106,6 @@ class RAGChatInterface:
123
  "解释embedding嵌入的原理",
124
  "什么是LLM Agent?",
125
  "如何防止LLM产生幻觉?",
126
- "Prompt Engineering的最佳实践是什么?"
127
  ],
128
  inputs=msg,
129
  label="💡 示例问题"
 
68
  return f"❌ 查询失败: {str(e)}"
69
 
70
  def create_interface(self):
71
+ """创建Gradio界面(兼容性增强版)"""
72
 
73
+ # 创建简单的聊天界面(避免版本兼容问题)
74
+ with gr.Blocks(title="🤖 自适应RAG智能问答") as demo:
 
 
 
 
 
 
 
 
 
 
75
  gr.Markdown(
76
  """
77
  # 🤖 自适应RAG智能问答系统
78
 
79
+ 基于LangGraph的自适应检索增强生成系统
 
 
 
 
80
 
81
  **使用方法**: 在下方输入框输入问题,系统会自动选择最佳检索策略并生成答案。
82
  """
83
  )
84
 
85
+ # 聊天界面(使用最简单的配置)
86
  chatbot = gr.Chatbot(
87
  label="对话历史",
88
+ height=500
 
 
89
  )
90
 
91
+ # 输入框
92
+ msg = gr.Textbox(
93
+ label="输入问题",
94
+ placeholder="例如: AlphaCodium论文讲的是什么?",
95
+ lines=2
96
+ )
 
 
97
 
98
  with gr.Row():
99
+ submit_btn = gr.Button("🚀 发送", variant="primary")
100
+ clear_btn = gr.Button("🗑️ 清空对话")
101
 
102
  # 示例问题
103
  gr.Examples(
 
106
  "解释embedding嵌入的原理",
107
  "什么是LLM Agent?",
108
  "如何防止LLM产生幻觉?",
 
109
  ],
110
  inputs=msg,
111
  label="💡 示例问题"