Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,8 @@ def text_to_sentences(text):
|
|
17 |
re.sub(r'(?<=[.!?])(?=[^\s])', r' ', text)
|
18 |
return re.split(r'[.!?]', text)
|
19 |
|
20 |
-
# function to concatenate sentences into chunks of size
|
21 |
-
def
|
22 |
sentences = text_to_sentences(text)
|
23 |
chunks = []
|
24 |
current_chunk = ""
|
@@ -47,7 +47,7 @@ def predict(query, device="cpu"):
|
|
47 |
return real
|
48 |
|
49 |
def findRealProb(text):
|
50 |
-
chunksOfText = (
|
51 |
results = []
|
52 |
for chunk in chunksOfText:
|
53 |
output = predict(chunk)
|
|
|
17 |
re.sub(r'(?<=[.!?])(?=[^\s])', r' ', text)
|
18 |
return re.split(r'[.!?]', text)
|
19 |
|
20 |
+
# function to concatenate sentences into chunks of size 900 or less
|
21 |
+
def chunks_of_900(text, chunk_size=900):
|
22 |
sentences = text_to_sentences(text)
|
23 |
chunks = []
|
24 |
current_chunk = ""
|
|
|
47 |
return real
|
48 |
|
49 |
def findRealProb(text):
|
50 |
+
chunksOfText = (chunks_of_900(text))
|
51 |
results = []
|
52 |
for chunk in chunksOfText:
|
53 |
output = predict(chunk)
|