Update app.py
Browse files10 unmodified lines11121314151619 unmodified lines3637383940414213 unmodified lines565758596061626364656667686970717210 unmodified linesdataset_items = {dataset.name: dataset for dataset in ABSADatasetList()}def get_example(dataset):task = 'apc'dataset_file = detect_infer_dataset(dataset_items[dataset], task)19 unmodified linesdef perform_inference(text, dataset):if not text:text = dataset_dict[dataset][random.randint(0, len(dataset_dict[dataset])-1)]result = aspect_extractor.extract_aspect(inference_source=[text],pred_sentiment=True)13 unmodified lineswith demo:gr.Markdown("# <p align='center'>Multilingual Aspect-based Sentiment Analysis !</p>")gr.Markdown("### Repo: [PyABSA](https://github.com/yangheng95/PyABSA)")gr.Markdown("""### Author: [Heng Yang](https://github.com/yangheng95) (杨恒)[](https://pepy.tech/project/pyabsa)[](https://pepy.tech/project/pyabsa)""")gr.Markdown("Your input text should be no more than 80 words, that's the longest text we used in training. However, you can try longer text in self-training ")output_dfs = []with gr.Row():with gr.Column():input_sentence = gr.Textbox(placeholder='Leave blank to give you a random result...', label="Example:")gr.Markdown("You can find the datasets at [github.com/yangheng95/ABSADatasets](https://github.com/yangheng95/ABSADatasets/tree/v1.2/datasets/text_classification)")dataset_ids = gr.Radio(choices=[dataset.name for dataset in ABSADatasetList()[:-1]], value='Laptop14', label="Datasets")inference_button = gr.Button("Let's go!")10 unmodified lines1112131415161719 unmodified lines3738394041424313 unmodified lines57585960616263646566676869707172737410 unmodified linesdataset_items = {dataset.name: dataset for dataset in ABSADatasetList()}def get_example(dataset):task = 'apc'dataset_file = detect_infer_dataset(dataset_items[dataset], task)19 unmodified linesdef perform_inference(text, dataset):if not text:text = dataset_dict[dataset][random.randint(0, len(dataset_dict[dataset]) - 1)]result = aspect_extractor.extract_aspect(inference_source=[text],pred_sentiment=True)13 unmodified lineswith demo:gr.Markdown("# <p align='center'>Multilingual Aspect-based Sentiment Analysis !</p>")gr.Markdown("""### Repo: [PyABSA](https://github.com/yangheng95/PyABSA)### Author: [Heng Yang](https://github.com/yangheng95) (杨恒)[](https://pepy.tech/project/pyabsa)[](https://pepy.tech/project/pyabsa)""")gr.Markdown("Your input text should be no more than 80 words, that's the longest text we used in training. However, you can try longer text in self-training ")gr.Markdown("**You don't need to split each Chinese (Korean, etc.) token as the provided, just input the natural language text.**")output_dfs = []with gr.Row():with gr.Column():input_sentence = gr.Textbox(placeholder='Leave this box blank and choose a dataset will give you a random example...', label="Example:")gr.Markdown("You can find the datasets at [github.com/yangheng95/ABSADatasets](https://github.com/yangheng95/ABSADatasets/tree/v1.2/datasets/text_classification)")dataset_ids = gr.Radio(choices=[dataset.name for dataset in ABSADatasetList()[:-1]], value='Laptop14', label="Datasets")inference_button = gr.Button("Let's go!")
app.py+6-4