Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,15 +22,15 @@ def validate_dataset(dataset):
|
|
| 22 |
|
| 23 |
def do_ask(question, button, dataset):
|
| 24 |
|
| 25 |
-
global docs
|
| 26 |
-
docs_ready = dataset.iloc[-1, 0] != ""
|
| 27 |
-
if button == "✨Listo✨" and docs_ready:
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
else:
|
| 33 |
-
|
| 34 |
|
| 35 |
# def do_ask(question, button, dataset, progress=gr.Progress()):
|
| 36 |
# global docs
|
|
|
|
| 22 |
|
| 23 |
def do_ask(question, button, dataset):
|
| 24 |
|
| 25 |
+
global docs
|
| 26 |
+
docs_ready = dataset.iloc[-1, 0] != ""
|
| 27 |
+
if button == "✨Listo✨" and docs_ready:
|
| 28 |
+
path = dataset["filepath"]
|
| 29 |
+
txt = Path('path.txt').read_text()
|
| 30 |
+
question_answerer = pipeline("question-answering", model='distilbert-base-cased-distilled-squad')
|
| 31 |
+
return question_answerer(question, context=text)
|
| 32 |
+
else:
|
| 33 |
+
return ""
|
| 34 |
|
| 35 |
# def do_ask(question, button, dataset, progress=gr.Progress()):
|
| 36 |
# global docs
|