orrinin commited on
Commit
8970dab
·
verified ·
1 Parent(s): 1f285b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -112,7 +112,7 @@ def infer(message:str, history: list):
112
  db_path = create_col(documents)
113
  memory = ChatMemoryBuffer.from_defaults(token_limit=3900)
114
  elif not message["text"].startswith("http://") and not message["text"].startswith("https://") and len(history) == 0:
115
- raise gr.Error("请先输入网址或上传文档。")
116
 
117
 
118
  # Load from disk
@@ -130,7 +130,7 @@ def infer(message:str, history: list):
130
  )
131
 
132
  if option == "web" and len(history) == 0:
133
- response = "获取成功,开始对话吧!"
134
  else:
135
  question = message['text']
136
 
@@ -163,11 +163,20 @@ css="""
163
  footer {
164
  display:none !important
165
  }
 
 
 
 
166
  """
167
 
 
 
 
 
 
168
 
169
 
170
- chatbot = gr.Chatbot(placeholder="请先输入网址或上传文档<br>然后进行对话", height=960)
171
 
172
  with gr.Blocks(theme="soft", css=css, fill_height="true") as demo:
173
  gr.ChatInterface(
 
112
  db_path = create_col(documents)
113
  memory = ChatMemoryBuffer.from_defaults(token_limit=3900)
114
  elif not message["text"].startswith("http://") and not message["text"].startswith("https://") and len(history) == 0:
115
+ raise gr.Error("Please send an URL or document")
116
 
117
 
118
  # Load from disk
 
130
  )
131
 
132
  if option == "web" and len(history) == 0:
133
+ response = "Getcha! Now ask your question."
134
  else:
135
  question = message['text']
136
 
 
163
  footer {
164
  display:none !important
165
  }
166
+ h1 {
167
+ text-align: center;
168
+ display: block;
169
+ }
170
  """
171
 
172
+ title=gr.Markdown("""
173
+ <h1>RAG demo</h1>
174
+ <p style="text-align: center">Retrieval for web and documents</p>
175
+ """
176
+ )
177
 
178
 
179
+ chatbot = gr.Chatbot(placeholder="Please send an URL or document file at first<br>Then ask question and get an answer.", height=800)
180
 
181
  with gr.Blocks(theme="soft", css=css, fill_height="true") as demo:
182
  gr.ChatInterface(