Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
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.
|
143 |
-
|
144 |
-
|
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()
|