Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,10 +29,11 @@ def do_ask(question, button, dataset):
|
|
| 29 |
global docs
|
| 30 |
docs_ready = dataset.iloc[-1, 0] != ""
|
| 31 |
if button == "✨Listo✨" and docs_ready:
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
| 36 |
else:
|
| 37 |
return ""
|
| 38 |
|
|
|
|
| 29 |
global docs
|
| 30 |
docs_ready = dataset.iloc[-1, 0] != ""
|
| 31 |
if button == "✨Listo✨" and docs_ready:
|
| 32 |
+
for _, row in dataset.iterrows():
|
| 33 |
+
path = row['filepath']
|
| 34 |
+
txt = Path(f'{path}').read_text()
|
| 35 |
+
question_answerer = pipeline("question-answering", model='distilbert-base-cased-distilled-squad')
|
| 36 |
+
return question_answerer(question, context=text)
|
| 37 |
else:
|
| 38 |
return ""
|
| 39 |
|