nhosseini commited on
Commit
81034d0
·
verified ·
1 Parent(s): b9f8ef1

Update app.py

Browse files

modify chunking

Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -36,8 +36,15 @@ def process_table_query(query, table_data):
36
  result_tapex = tokenizer_tapex.batch_decode(outputs, skip_special_tokens=True)[0]
37
  results.append(result_tapex)
38
 
39
- # Aggregate results
40
- return ' '.join(results)
 
 
 
 
 
 
 
41
 
42
  # Gradio interface
43
  def answer_query_from_csv(query, file):
 
36
  result_tapex = tokenizer_tapex.batch_decode(outputs, skip_special_tokens=True)[0]
37
  results.append(result_tapex)
38
 
39
+ # Aggregate results (example: summing numerical values if the query is sum-related)
40
+ try:
41
+ # Convert the list of results to floats and sum them
42
+ numerical_results = [float(r) for r in results if r.strip().isdigit()]
43
+ total_sum = sum(numerical_results)
44
+ return str(total_sum)
45
+ except ValueError:
46
+ # If the results are not numerical, return the joined string
47
+ return ' '.join(results)
48
 
49
  # Gradio interface
50
  def answer_query_from_csv(query, file):