Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from transformers import (AutoModelForQuestionAnswering,
|
|
5 |
|
6 |
import pandas as pd
|
7 |
import regex as re
|
8 |
-
from urllib import request
|
9 |
|
10 |
# Select model for question answering
|
11 |
model_name = "deepset/roberta-base-squad2"
|
@@ -18,9 +18,11 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
18 |
pipe = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
19 |
|
20 |
# Load Harry Potter book corpus from link
|
21 |
-
url = ("https://raw.githubusercontent.com/formcept/whiteboard/master/nbviewer/notebooks/data/harrypotter/Book%201%20-%20The%20Philosopher's%20Stone.txt")
|
22 |
-
response = request.urlopen(url)
|
23 |
-
book1_raw_0 = response.read().decode('utf8')
|
|
|
|
|
24 |
|
25 |
# Text pre-processing
|
26 |
# Remove page statements
|
|
|
5 |
|
6 |
import pandas as pd
|
7 |
import regex as re
|
8 |
+
# from urllib import request
|
9 |
|
10 |
# Select model for question answering
|
11 |
model_name = "deepset/roberta-base-squad2"
|
|
|
18 |
pipe = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
19 |
|
20 |
# Load Harry Potter book corpus from link
|
21 |
+
# url = ("https://raw.githubusercontent.com/formcept/whiteboard/master/nbviewer/notebooks/data/harrypotter/Book%201%20-%20The%20Philosopher's%20Stone.txt")
|
22 |
+
# response = request.urlopen(url)
|
23 |
+
# book1_raw_0 = response.read().decode('utf8')
|
24 |
+
|
25 |
+
book1_raw_0 = open('book_1.txt', mode='r', buffering=-1, encoding='utf8', errors=None, newline=None, closefd=True, opener=None)
|
26 |
|
27 |
# Text pre-processing
|
28 |
# Remove page statements
|