Spaces:
Sleeping
Sleeping
Commit
·
6cac26d
1
Parent(s):
0be2042
fixed history
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ template_html = env.get_template('template_html.j2')
|
|
24 |
def add_text(text, history):
|
25 |
history = [] if history is None else history
|
26 |
history = history + [(text, None)]
|
27 |
-
return
|
28 |
|
29 |
|
30 |
def turn_on_activity():
|
@@ -37,6 +37,8 @@ def bot(history):
|
|
37 |
if not user_query:
|
38 |
raise gr.Warning("Please submit a non-empty string")
|
39 |
|
|
|
|
|
40 |
retrieve_query = define_query(user_query, chat_model)
|
41 |
documents = faiss_index.similarity_search(retrieve_query) if retrieve_query else ''
|
42 |
user_prompt = USER_PROMPT(user_query, documents)
|
@@ -78,7 +80,7 @@ with (gr.Blocks() as demo):
|
|
78 |
bot, [chatbot], [chatbot, prompt_html]
|
79 |
)
|
80 |
|
81 |
-
txt_msg.then(
|
82 |
|
83 |
txt_msg = txt.submit(
|
84 |
add_text, [txt, chatbot], [txt, chatbot], queue=False
|
@@ -86,7 +88,7 @@ with (gr.Blocks() as demo):
|
|
86 |
bot, [chatbot], [chatbot, prompt_html]
|
87 |
)
|
88 |
|
89 |
-
txt_msg.then(
|
90 |
|
91 |
demo.queue()
|
92 |
demo.launch(debug=True)
|
|
|
24 |
def add_text(text, history):
|
25 |
history = [] if history is None else history
|
26 |
history = history + [(text, None)]
|
27 |
+
return history, gr.Textbox(value="", interactive=False)
|
28 |
|
29 |
|
30 |
def turn_on_activity():
|
|
|
37 |
if not user_query:
|
38 |
raise gr.Warning("Please submit a non-empty string")
|
39 |
|
40 |
+
logger.info('Retrieving documents...')
|
41 |
+
|
42 |
retrieve_query = define_query(user_query, chat_model)
|
43 |
documents = faiss_index.similarity_search(retrieve_query) if retrieve_query else ''
|
44 |
user_prompt = USER_PROMPT(user_query, documents)
|
|
|
80 |
bot, [chatbot], [chatbot, prompt_html]
|
81 |
)
|
82 |
|
83 |
+
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|
84 |
|
85 |
txt_msg = txt.submit(
|
86 |
add_text, [txt, chatbot], [txt, chatbot], queue=False
|
|
|
88 |
bot, [chatbot], [chatbot, prompt_html]
|
89 |
)
|
90 |
|
91 |
+
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|
92 |
|
93 |
demo.queue()
|
94 |
demo.launch(debug=True)
|