Spaces:
Running
Running
Circhastic
commited on
Commit
•
3e41dea
1
Parent(s):
0921718
Fix app
Browse files
app.py
CHANGED
@@ -87,7 +87,7 @@ def date_format(dataframe):
|
|
87 |
def group_to_three(dataframe):
|
88 |
dataframe['Date'] = pd.to_datetime(dataframe['Date'])
|
89 |
dataframe = dataframe.groupby([pd.Grouper(key='Date', freq='3D')])['Sales'].mean().round(2)
|
90 |
-
dataframe = dataframe.replace(0,
|
91 |
|
92 |
return dataframe
|
93 |
|
@@ -157,14 +157,14 @@ def sales_growth(dataframe, fittedValues):
|
|
157 |
|
158 |
# TAPAS Model
|
159 |
model_name = "google/tapas-large-finetuned-wtq"
|
|
|
|
|
160 |
|
161 |
-
def load_tapas_model(
|
162 |
-
tokenizer = TapasTokenizer.from_pretrained(model_name)
|
163 |
-
model = TapasForQuestionAnswering.from_pretrained(model_name, local_files_only=False)
|
164 |
pipe = pipeline("table-question-answering", model=model, tokenizer=tokenizer)
|
165 |
return pipe
|
166 |
|
167 |
-
pipe = load_tapas_model(
|
168 |
|
169 |
def get_answer(table, query):
|
170 |
answers = pipe(table=table, query=query)
|
|
|
87 |
def group_to_three(dataframe):
|
88 |
dataframe['Date'] = pd.to_datetime(dataframe['Date'])
|
89 |
dataframe = dataframe.groupby([pd.Grouper(key='Date', freq='3D')])['Sales'].mean().round(2)
|
90 |
+
dataframe = dataframe.replace(0, np.nan).dropna()
|
91 |
|
92 |
return dataframe
|
93 |
|
|
|
157 |
|
158 |
# TAPAS Model
|
159 |
model_name = "google/tapas-large-finetuned-wtq"
|
160 |
+
tokenizer = TapasTokenizer.from_pretrained(model_name)
|
161 |
+
model = TapasForQuestionAnswering.from_pretrained(model_name, local_files_only=False)
|
162 |
|
163 |
+
def load_tapas_model(model, tokenizer):
|
|
|
|
|
164 |
pipe = pipeline("table-question-answering", model=model, tokenizer=tokenizer)
|
165 |
return pipe
|
166 |
|
167 |
+
pipe = load_tapas_model(model, tokenizer)
|
168 |
|
169 |
def get_answer(table, query):
|
170 |
answers = pipe(table=table, query=query)
|