Update app.py
Browse files
app.py
CHANGED
@@ -45,9 +45,12 @@ def predict(input, history=[]):
|
|
45 |
if is_question:
|
46 |
sql_encoding = sql_tokenizer(table=table, query=input + sql_tokenizer.eos_token, return_tensors="pt")
|
47 |
sql_outputs = sql_model.generate(**sql_encoding)
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
history.append(response)
|
51 |
|
52 |
'''
|
53 |
bot_input_ids = torch.cat([torch.LongTensor(history), sql_encoding], dim=-1)
|
|
|
45 |
if is_question:
|
46 |
sql_encoding = sql_tokenizer(table=table, query=input + sql_tokenizer.eos_token, return_tensors="pt")
|
47 |
sql_outputs = sql_model.generate(**sql_encoding)
|
48 |
+
sql_response = sql_tokenizer.batch_decode(sql_outputs, skip_special_tokens=True)
|
49 |
+
|
50 |
+
# Append the SQL model's response to the history
|
51 |
+
sql_response_ids = tokenizer.encode(sql_response + tokenizer.eos_token, return_tensors='pt')
|
52 |
+
history.extend(sql_response_ids[0].tolist()) # Add SQL response token IDs to history
|
53 |
|
|
|
54 |
|
55 |
'''
|
56 |
bot_input_ids = torch.cat([torch.LongTensor(history), sql_encoding], dim=-1)
|