albhu commited on
Commit
bbfaf4f
·
verified ·
1 Parent(s): 2532ae2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -106,19 +106,19 @@ class InterestCalculatorApp:
106
 
107
  def ask_tapas(self, query, table):
108
  if isinstance(table, pd.DataFrame):
109
- # Convert the DataFrame to a list of dictionaries
110
- table_dict = table.to_dict('records')
111
 
112
  # Tokenize each cell in the table
113
- tokenized_table = [[self.tokenizer.tokenize(str(cell)) for cell in row.values()] for row in table_dict]
114
 
115
  # Encode tokens and convert them to PyTorch tensors
116
- inputs = self.tokenizer(table=tokenized_table, queries=query, return_tensors="pt", padding=True)
117
 
118
  return inputs
119
  else:
120
  raise TypeError("Table must be of type pd.DataFrame")
121
-
122
 
123
 
124
  def main():
 
106
 
107
  def ask_tapas(self, query, table):
108
  if isinstance(table, pd.DataFrame):
109
+ # Tokenize the query
110
+ tokenized_query = self.tokenizer.tokenize(query)
111
 
112
  # Tokenize each cell in the table
113
+ tokenized_table = [[self.tokenizer.tokenize(str(cell)) for cell in row] for row in table.values]
114
 
115
  # Encode tokens and convert them to PyTorch tensors
116
+ inputs = self.tokenizer(table=tokenized_table, queries=tokenized_query, return_tensors="pt", padding=True)
117
 
118
  return inputs
119
  else:
120
  raise TypeError("Table must be of type pd.DataFrame")
121
+
122
 
123
 
124
  def main():