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 |
-
|
68 |
|
69 |
def chat(input, history=[]):
|
70 |
|
@@ -99,7 +99,7 @@ def chat(input, history=[]):
|
|
99 |
|
100 |
def sqlquery(input):
|
101 |
|
102 |
-
|
103 |
|
104 |
#input_text = " ".join(conversation_history) + " " + input
|
105 |
sql_encoding = sql_tokenizer(table=table, query=input + sql_tokenizer.eos_token, return_tensors="pt")
|
@@ -117,8 +117,8 @@ def sqlquery(input):
|
|
117 |
return output
|
118 |
'''
|
119 |
|
120 |
-
|
121 |
-
|
122 |
html = "<div class='chatbot'>"
|
123 |
for user_msg, resp_msg in history:
|
124 |
html += f"<div class='user_msg'>{user_msg}</div>"
|
|
|
64 |
sql_model = BartForConditionalGeneration.from_pretrained(sql_model_name)
|
65 |
|
66 |
#sql_response = None
|
67 |
+
conversation_history = []
|
68 |
|
69 |
def chat(input, history=[]):
|
70 |
|
|
|
99 |
|
100 |
def sqlquery(input):
|
101 |
|
102 |
+
global conversation_history
|
103 |
|
104 |
#input_text = " ".join(conversation_history) + " " + input
|
105 |
sql_encoding = sql_tokenizer(table=table, query=input + sql_tokenizer.eos_token, return_tensors="pt")
|
|
|
117 |
return output
|
118 |
'''
|
119 |
|
120 |
+
conversation_history.append((input, sql_response))
|
121 |
+
|
122 |
html = "<div class='chatbot'>"
|
123 |
for user_msg, resp_msg in history:
|
124 |
html += f"<div class='user_msg'>{user_msg}</div>"
|