Spaces:
Build error
Build error
Commit
·
53d88c3
1
Parent(s):
736842d
Create tapas_utils.py
Browse files- tapas_utils.py +14 -0
tapas_utils.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import AutoTokenizer, AutoModelForTableQuestionAnswering
|
| 2 |
+
import pandas as pd
|
| 3 |
+
from io import StringIO
|
| 4 |
+
|
| 5 |
+
def initialize_tapas():
|
| 6 |
+
tokenizer = AutoTokenizer.from_pretrained("google/tapas-large-finetuned-wtq")
|
| 7 |
+
model = AutoModelForTableQuestionAnswering.from_pretrained("google/tapas-large-finetuned-wtq")
|
| 8 |
+
return tokenizer, model
|
| 9 |
+
|
| 10 |
+
def ask_llm_chunk(tokenizer, model, chunk, questions):
|
| 11 |
+
# ... [same as in your code]
|
| 12 |
+
|
| 13 |
+
def summarize_map_reduce(tokenizer, model, data, questions):
|
| 14 |
+
# ... [same as in your code]
|