CoolFace
Apppublic

Linhz/ViMNer

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes
app_MNER.cpython-39.pyc9 linesDownload Raw Back to __pycache__
1a

2��df��@s2ddlZddlmZddlmZddlZddlmZm	Z	m3Z4ddlZddlm
Z
mZddlmZmZmZmZmZmZddlmZddlmZdd	lmZddlZddlZdd5lm Z ddl!m"Z"ddl#m$Z$d
Z%dZ&e�'ej(�)�r�dnd�Z'e*ed��Z+e+�,e�-ej.�/dd���ee+de'�Z0dd�Z1dd�Z2dS)�N)�displacy)�ViTagger)�save_uploaded_image�convert_text_to_txt�add_string_to_txt)�
AutoTokenizer�6BertConfig)�format_predictions�process_predictions�combine_entities�remove_B_prefix�7load_model�predict)�get_test_examples_predict)�resnet)�myResnet)�MNERProcessor_2016)�show_mner_2016)�show_mner_2021zbert_config.jsonzpytorch_model.bin�cuda�cpuZ	resnet152z)E:/demo_datn/pythonProject1/Model/Resnet/z
resnet152.pthTcCst�dd|���}|S)Nz\s+� )�re�sub�strip)�text�processed_text�r�;E:\demo_datn\pythonProject1\Model\MultimodelNER\app_MNER.py�process_textsrcCs>tj�d�tj�dd�}t�d�|dkr4t�nt�dS)N�Datasets)�VLSP2016�VLSP2021zMultimodal NERr!)�st�sidebar�title�	selectbox�headerrr)�datasetrrr�	show_mner"s8r))3�	streamlitr#�spacyr�Model.NER.VLSP2021.Predict_NerrrZ
thunghiemxulyrrr�os�transformersrrZ+Model.MultimodelNER.VLSP2016.train_umt_2016r	r9rrr
rZModel.MultimodelNER.predictrZModel.MultimodelNERrZ Model.MultimodelNER.resnet_utilsr�torch�numpy�npZ,Model.MultimodelNER.VLSP2016.dataset_robertarZ&Model.MultimodelNER.VLSP2016.MNER_2016rZ&Model.MultimodelNER.VLSP2021.MNER_2021r�CONFIG_NAME�WEIGHTS_NAME�devicer�is_available�getattr�net�load_state_dict�load�path�join�encoderrr)rrrr�<module>s.