Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,7 @@ sql_tokenizer = TapexTokenizer.from_pretrained(sql_model_name)
|
|
64 |
sql_model = BartForConditionalGeneration.from_pretrained(sql_model_name)
|
65 |
|
66 |
#sql_response = None
|
67 |
-
conversation_history = []
|
68 |
|
69 |
def chat(input, history=[]):
|
70 |
|
@@ -104,17 +104,17 @@ def sqlquery(input):
|
|
104 |
sql_outputs = sql_model.generate(**sql_encoding)
|
105 |
sql_response = sql_tokenizer.batch_decode(sql_outputs, skip_special_tokens=True)
|
106 |
|
107 |
-
|
108 |
global conversation_history
|
109 |
|
110 |
# Maintain the conversation history
|
111 |
-
conversation_history.append("User: " + input + "
|
112 |
-
conversation_history.append("Bot: " + " ".join(sql_response) + "
|
113 |
|
114 |
output = " ".join(conversation_history)
|
115 |
return output
|
116 |
-
|
117 |
-
|
118 |
|
119 |
|
120 |
chat_interface = gr.Interface(
|
@@ -132,8 +132,8 @@ sql_interface = gr.Interface(
|
|
132 |
theme="default",
|
133 |
inputs=gr.Textbox(prompt="You:"),
|
134 |
outputs=gr.Textbox(),
|
135 |
-
live=True,
|
136 |
-
capture_session=True,
|
137 |
title="ST SQL Chat",
|
138 |
description="Type your message in the box above, and the chatbot will respond.",
|
139 |
)
|
|
|
64 |
sql_model = BartForConditionalGeneration.from_pretrained(sql_model_name)
|
65 |
|
66 |
#sql_response = None
|
67 |
+
#conversation_history = []
|
68 |
|
69 |
def chat(input, history=[]):
|
70 |
|
|
|
104 |
sql_outputs = sql_model.generate(**sql_encoding)
|
105 |
sql_response = sql_tokenizer.batch_decode(sql_outputs, skip_special_tokens=True)
|
106 |
|
107 |
+
'''
|
108 |
global conversation_history
|
109 |
|
110 |
# Maintain the conversation history
|
111 |
+
conversation_history.append("User: " + input + "\n")
|
112 |
+
conversation_history.append("Bot: " + " ".join(sql_response) + "\n" )
|
113 |
|
114 |
output = " ".join(conversation_history)
|
115 |
return output
|
116 |
+
'''
|
117 |
+
return sql_response
|
118 |
|
119 |
|
120 |
chat_interface = gr.Interface(
|
|
|
132 |
theme="default",
|
133 |
inputs=gr.Textbox(prompt="You:"),
|
134 |
outputs=gr.Textbox(),
|
135 |
+
#live=True,
|
136 |
+
#capture_session=True,
|
137 |
title="ST SQL Chat",
|
138 |
description="Type your message in the box above, and the chatbot will respond.",
|
139 |
)
|