import gradio from kbert_topics import extract_topics from mapping import get_mapping from topics_extraction import classify from PyDictionary import PyDictionary dictionary=PyDictionary() def get_output(event_info): if len(event_info.split(' '))>=20: topic_name, distance_name,topic_name_dep, distance_name_dep, topic_name_other, distance_name_other = get_mapping(event_info) work_list = extract_topics(event_info) work_list = [i for i in work_list if bool(dictionary.meaning(i))] return topic_name+ ' '+str(distance_name), str(topic_name_dep) + ' '+str(distance_name_dep),str(topic_name_other) + ' '+str(distance_name_other), str(work_list),classify(event_info) else: return 'Event discription should have >= 20 words', None, None, None,None with gradio.Blocks(theme = 'gradio/monochrome', title = 'Keyword clustering Demo') as keyword_cluster_demo: gradio.Markdown( "
Interface for checking results of keyword generation and sector/other industries mapping
" ) gradio.HTML( """