Spaces:
Runtime error
Runtime error
Caitlin Blackmore commited on
Commit ·
020b94a
1
Parent(s): b95d9ff
add nltk stopwords
Browse files
main.py
CHANGED
|
@@ -8,6 +8,7 @@ from bs4 import BeautifulSoup
|
|
| 8 |
from cleantext import clean
|
| 9 |
from docx import Document
|
| 10 |
import os
|
|
|
|
| 11 |
import cohere
|
| 12 |
from cohere import CohereError
|
| 13 |
import string
|
|
@@ -19,6 +20,15 @@ from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassifica
|
|
| 19 |
from dotenv import load_dotenv
|
| 20 |
load_dotenv()
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
app = FastAPI()
|
| 23 |
app.mount("/static", StaticFiles(directory='static'), name="static")
|
| 24 |
templates = Jinja2Templates(directory="templates/")
|
|
|
|
| 8 |
from cleantext import clean
|
| 9 |
from docx import Document
|
| 10 |
import os
|
| 11 |
+
import ssl
|
| 12 |
import cohere
|
| 13 |
from cohere import CohereError
|
| 14 |
import string
|
|
|
|
| 20 |
from dotenv import load_dotenv
|
| 21 |
load_dotenv()
|
| 22 |
|
| 23 |
+
try:
|
| 24 |
+
_create_unverified_https_context = ssl._create_unverified_context
|
| 25 |
+
except AttributeError:
|
| 26 |
+
pass
|
| 27 |
+
else:
|
| 28 |
+
ssl._create_default_https_context = _create_unverified_https_context
|
| 29 |
+
if os.path.isdir('nltk_data')==False:
|
| 30 |
+
nltk.download('stopwords', quiet=True)
|
| 31 |
+
|
| 32 |
app = FastAPI()
|
| 33 |
app.mount("/static", StaticFiles(directory='static'), name="static")
|
| 34 |
templates = Jinja2Templates(directory="templates/")
|