add punkt installer
This commit is contained in:
parent
2e80ccceab
commit
15557188d8
|
@ -1,9 +1,17 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
import nltk
|
||||
|
||||
script_dir = Path(os.path.dirname(os.path.realpath(__file__)))
|
||||
target = script_dir / 'punkt'
|
||||
print('Downloading punkt to:', target)
|
||||
print('Target directory:', target)
|
||||
|
||||
|
||||
print('Erasing old install...')
|
||||
shutil.rmtree(target, ignore_errors=True)
|
||||
|
||||
print('Downloading punkt...')
|
||||
nltk.download('punkt', download_dir=target)
|
||||
|
|
|
@ -68,7 +68,6 @@ async def startup_event():
|
|||
if not (script_dir / 'punkt' / 'tokenizers' / 'punkt').is_dir():
|
||||
logger.critical(f'Punkt not found at "{script_dir}/punkt". Please run "./punkt-download.py" first.')
|
||||
sys.exit(1)
|
||||
nltk.download('punkt', download_dir=script_dir / 'punkt')
|
||||
q = asyncio.Queue()
|
||||
app.model_queue = q
|
||||
await asyncio.create_task(server_loop(q))
|
||||
|
|
Loading…
Reference in New Issue