Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,7 +35,11 @@ def do_ask(question, button, dataset):
|
|
| 35 |
path = row['filepath']
|
| 36 |
text = Path(f'{path}').read_text()
|
| 37 |
question_answerer = pipeline("question-answering", model='distilbert-base-cased-distilled-squad')
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
else:
|
| 40 |
return ""
|
| 41 |
|
|
|
|
| 35 |
path = row['filepath']
|
| 36 |
text = Path(f'{path}').read_text()
|
| 37 |
question_answerer = pipeline("question-answering", model='distilbert-base-cased-distilled-squad')
|
| 38 |
+
QA_input = {
|
| 39 |
+
'question': question,
|
| 40 |
+
'context': text
|
| 41 |
+
}
|
| 42 |
+
return question_answerer(QA_input)['answer']
|
| 43 |
else:
|
| 44 |
return ""
|
| 45 |
|