Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import pandas as pd
|
| 2 |
-
from transformers import pipeline
|
| 3 |
|
| 4 |
import PIL
|
| 5 |
from PIL import Image
|
|
@@ -24,8 +23,15 @@ config['predictor']['beamsearch'] = True
|
|
| 24 |
config['device'] = 'cpu' # mps
|
| 25 |
|
| 26 |
recognitor = Predictor(config)
|
| 27 |
-
model_name = "microsoft/xdoc-base-squad2.0"
|
| 28 |
-
nlp = pipeline('question-answering', model=model_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
def query(doc, labels):
|
| 31 |
questions = labels.split(", ")
|
|
|
|
| 1 |
import pandas as pd
|
|
|
|
| 2 |
|
| 3 |
import PIL
|
| 4 |
from PIL import Image
|
|
|
|
| 23 |
config['device'] = 'cpu' # mps
|
| 24 |
|
| 25 |
recognitor = Predictor(config)
|
| 26 |
+
#model_name = "microsoft/xdoc-base-squad2.0"
|
| 27 |
+
#nlp = pipeline('question-answering', model=model_name)
|
| 28 |
+
|
| 29 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 30 |
+
|
| 31 |
+
model_name = "timpal0l/mdeberta-v3-base-squad2"
|
| 32 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 33 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 34 |
+
nlp = pipeline('question-answering', model=model, tokenizer=tokenizer)
|
| 35 |
|
| 36 |
def query(doc, labels):
|
| 37 |
questions = labels.split(", ")
|