hertogateis commited on
Commit
31de781
·
verified ·
1 Parent(s): c5b17da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -48,8 +48,9 @@ else:
48
  df = None
49
 
50
  if df is not None:
51
- # Convert object columns to numeric where possible
52
- df = df.apply(pd.to_numeric, errors='ignore')
 
53
 
54
  st.write("Original Data:")
55
  st.write(df)
@@ -75,8 +76,11 @@ else:
75
  result = tqa(table=df, query=question)
76
 
77
  # Check if TAPAS is returning the expected answer
78
- answer = result['answer']
79
- st.write(f"TAPAS Answer: {answer}")
 
 
 
80
 
81
  # Determine if the question relates to graph generation
82
  if 'between' in question.lower() and 'and' in question.lower():
 
48
  df = None
49
 
50
  if df is not None:
51
+ # Convert object columns to numeric where possible, handle errors explicitly
52
+ for column in df.select_dtypes(include=['object']).columns:
53
+ df[column] = pd.to_numeric(df[column], errors='coerce')
54
 
55
  st.write("Original Data:")
56
  st.write(df)
 
76
  result = tqa(table=df, query=question)
77
 
78
  # Check if TAPAS is returning the expected answer
79
+ answer = result.get('answer', None)
80
+ if answer:
81
+ st.write(f"TAPAS Answer: {answer}")
82
+ else:
83
+ st.warning("TAPAS did not return a valid answer.")
84
 
85
  # Determine if the question relates to graph generation
86
  if 'between' in question.lower() and 'and' in question.lower():