Spaces:
Sleeping
Sleeping
handled punkt error1
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ import gradio as gr
|
|
| 18 |
import pandas as pd
|
| 19 |
import json
|
| 20 |
|
| 21 |
-
# Download required
|
| 22 |
nltk.download('punkt')
|
| 23 |
|
| 24 |
# Load spaCy English model
|
|
@@ -86,7 +86,7 @@ def load_documents(file_paths):
|
|
| 86 |
logger.error(f"Error processing file {file_path}: {e}")
|
| 87 |
return docs
|
| 88 |
|
| 89 |
-
# Function to ensure the response ends with complete sentences using
|
| 90 |
def ensure_complete_sentences(text):
|
| 91 |
sentences = sent_tokenize(text)
|
| 92 |
if sentences:
|
|
|
|
| 18 |
import pandas as pd
|
| 19 |
import json
|
| 20 |
|
| 21 |
+
# Download required NLTK resources
|
| 22 |
nltk.download('punkt')
|
| 23 |
|
| 24 |
# Load spaCy English model
|
|
|
|
| 86 |
logger.error(f"Error processing file {file_path}: {e}")
|
| 87 |
return docs
|
| 88 |
|
| 89 |
+
# Function to ensure the response ends with complete sentences using NLTK
|
| 90 |
def ensure_complete_sentences(text):
|
| 91 |
sentences = sent_tokenize(text)
|
| 92 |
if sentences:
|