mirror of https://github.com/explosion/spaCy.git
Link model automatically if not direct download
This commit is contained in:
parent
618ce3b425
commit
8253581057
|
@ -5,6 +5,7 @@ import pip
|
||||||
import plac
|
import plac
|
||||||
import requests
|
import requests
|
||||||
from os import path
|
from os import path
|
||||||
|
from .link import link
|
||||||
from . import about
|
from . import about
|
||||||
from . import util
|
from . import util
|
||||||
|
|
||||||
|
@ -21,11 +22,11 @@ def download(model=None, direct=False):
|
||||||
if direct:
|
if direct:
|
||||||
download_model('{m}/{m}.tar.gz'.format(m=model))
|
download_model('{m}/{m}.tar.gz'.format(m=model))
|
||||||
else:
|
else:
|
||||||
model = about.__shortcuts__[model] if model in about.__shortcuts__ else model
|
model_name = about.__shortcuts__[model] if model in about.__shortcuts__ else model
|
||||||
compatibility = get_compatibility()
|
compatibility = get_compatibility()
|
||||||
version = get_version(model, compatibility)
|
version = get_version(model_name, compatibility)
|
||||||
download_model('{m}-{v}/{m}-{v}.tar.gz'.format(m=model, v=version))
|
download_model('{m}-{v}/{m}-{v}.tar.gz'.format(m=model_name, v=version))
|
||||||
|
link(model_name, model, force=True)
|
||||||
|
|
||||||
def get_compatibility():
|
def get_compatibility():
|
||||||
version = about.__version__
|
version = about.__version__
|
||||||
|
|
Loading…
Reference in New Issue