File size: 552 Bytes
21e639d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import asyncio
import streamlit as st
from pathlib import Path
from configs import ckip_path, download_ckip_drivers


def dowload_ckip_package(ckip_nlp_models):
    drivers = list(
        map(lambda model: ckip_path / f"{model}_drivers.pickle", ckip_nlp_models)
    )

    while not all(list(map(lambda path: Path(path).exists(), drivers))):
        with st.spinner("Downloading CKIP models ..."):
            asyncio.run(download_ckip_drivers(ckip_nlp_models))

        if all(list(map(lambda path: Path(path).exists(), drivers))):
            break