Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,12 +8,16 @@ from transformers import (
|
|
| 8 |
pipeline,
|
| 9 |
)
|
| 10 |
|
| 11 |
-
model_tapex = "microsoft/tapex-large-finetuned-wtq"
|
| 12 |
-
tokenizer_tapex = AutoTokenizer.from_pretrained(model_tapex)
|
| 13 |
-
model_tapex = AutoModelForSeq2SeqLM.from_pretrained(model_tapex)
|
| 14 |
-
pipe_tapex = pipeline(
|
| 15 |
-
|
| 16 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# model_tapas = "google/tapas-large-finetuned-wtq"
|
| 19 |
# tokenizer_tapas = AutoTokenizer.from_pretrained(model_tapas)
|
|
@@ -35,9 +39,9 @@ def process(query, file, correct_answer, rows=20):
|
|
| 35 |
def process2(query, csv_data):
|
| 36 |
csv_data={"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
|
| 37 |
table = pd.DataFrame.from_dict(csv_data)
|
| 38 |
-
|
| 39 |
result_tapas = pipe_tapas(table=table, query=query)['cells'][0]
|
| 40 |
-
return
|
| 41 |
|
| 42 |
|
| 43 |
# Inputs
|
|
|
|
| 8 |
pipeline,
|
| 9 |
)
|
| 10 |
|
| 11 |
+
# model_tapex = "microsoft/tapex-large-finetuned-wtq"
|
| 12 |
+
# tokenizer_tapex = AutoTokenizer.from_pretrained(model_tapex)
|
| 13 |
+
# model_tapex = AutoModelForSeq2SeqLM.from_pretrained(model_tapex)
|
| 14 |
+
# pipe_tapex = pipeline(
|
| 15 |
+
# "table-question-answering", model=model_tapex, tokenizer=tokenizer_tapex
|
| 16 |
+
# )
|
| 17 |
+
|
| 18 |
+
#new
|
| 19 |
+
pipe_tapex = pipeline(task="table-question-answering", model="microsoft/tapex-large-finetuned-wtq")
|
| 20 |
+
|
| 21 |
|
| 22 |
# model_tapas = "google/tapas-large-finetuned-wtq"
|
| 23 |
# tokenizer_tapas = AutoTokenizer.from_pretrained(model_tapas)
|
|
|
|
| 39 |
def process2(query, csv_data):
|
| 40 |
csv_data={"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
|
| 41 |
table = pd.DataFrame.from_dict(csv_data)
|
| 42 |
+
result_tapex = pipe_tapex(table=table, query=query)['cells'][0]
|
| 43 |
result_tapas = pipe_tapas(table=table, query=query)['cells'][0]
|
| 44 |
+
return result_tapex, result_tapas
|
| 45 |
|
| 46 |
|
| 47 |
# Inputs
|