cowcow02 commited on
Commit
594e99d
1 Parent(s): e9e8863

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import re
2
  from typing import List
3
 
4
  import gradio as gr
@@ -91,6 +90,10 @@ def predict(message, history):
91
  yield partial_message
92
 
93
 
 
 
 
 
94
  def predict_with_rag(message, history):
95
  return predict(message, history)
96
 
@@ -139,10 +142,13 @@ chatbot = gr.Chatbot()
139
  with gr.Blocks() as demo:
140
  gr.Markdown("# 地區服務中心智能助理")
141
 
142
- gr.ChatInterface(predict,
143
- chatbot=chatbot,
144
- examples=CHAT_EXAMPLES,
145
- )
 
 
 
146
  chatbot.like(vote, None, None)
147
 
148
  demo.queue()
 
 
1
  from typing import List
2
 
3
  import gradio as gr
 
90
  yield partial_message
91
 
92
 
93
+ def predict_without_history(message, history):
94
+ return predict(message, [])
95
+
96
+
97
  def predict_with_rag(message, history):
98
  return predict(message, history)
99
 
 
142
  with gr.Blocks() as demo:
143
  gr.Markdown("# 地區服務中心智能助理")
144
 
145
+ with gr.Tab("OPTION 1: With History"):
146
+ gr.ChatInterface(predict,
147
+ chatbot=chatbot,
148
+ examples=CHAT_EXAMPLES,
149
+ )
150
+ with gr.Tab("OPTION 2: Without History"):
151
+ gr.ChatInterface(predict_without_history, examples=CHAT_EXAMPLES)
152
  chatbot.like(vote, None, None)
153
 
154
  demo.queue()