Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Update app[tapex].py
Browse files- app[tapex].py +13 -5
app[tapex].py
CHANGED
@@ -4,11 +4,19 @@ import torch
|
|
4 |
from transformers import TapexTokenizer, BartForConditionalGeneration
|
5 |
import datetime
|
6 |
|
7 |
-
# Load the
|
8 |
-
df = pd.
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Function to generate a response using the TAPEX model
|
14 |
def response(user_question, table_data):
|
|
|
4 |
from transformers import TapexTokenizer, BartForConditionalGeneration
|
5 |
import datetime
|
6 |
|
7 |
+
# Load the CSV file
|
8 |
+
df = pd.read_csv("anomalies.csv", quotechar='"')
|
9 |
+
|
10 |
+
# Filter 'real' higher than 10 Million
|
11 |
+
df= df[df['real'] >= 1000000.]
|
12 |
+
|
13 |
+
# Convert 'real' column to standard float format and then to strings
|
14 |
+
df['real'] = df['real'].apply(lambda x: f"{x:.2f}")
|
15 |
+
|
16 |
+
# Fill NaN values and convert all columns to strings
|
17 |
+
df = df.fillna('').astype(str)
|
18 |
+
|
19 |
+
table_data = df
|
20 |
|
21 |
# Function to generate a response using the TAPEX model
|
22 |
def response(user_question, table_data):
|