File size: 2,280 Bytes
eb3c5e9
 
 
2e6a042
dcf2a73
 
eb3c5e9
 
 
c7236e1
066ab05
c7236e1
066ab05
 
c7236e1
066ab05
eb3c5e9
c7236e1
eb3c5e9
 
 
 
 
 
 
 
 
 
 
 
 
10e33c0
eb3c5e9
770d753
066ab05
 
 
770d753
 
 
 
eb3c5e9
 
 
 
 
066ab05
eb3c5e9
 
e41b1a5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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(
        "<p align='center' style='font-size: 20px;'> Interface for checking results of keyword generation and sector/other industries mapping</p>"
    )
    gradio.HTML(
        """<center> Enter event discription <br>Note: Minimum 20 words</center>"""
    ) 
    gradio.HTML(
    """<center><div style="background-color: grey; padding: 5px; color: white; display: inline-block;">Time taken: 2 min </div></center>"""
    )
    with gradio.Row(scale = 2):
        with gradio.Column(scale=1):
          event_info = gradio.Textbox(label='enter event discription')
          button = gradio.Button("Submit")
            
        output_sec = gradio.outputs.Textbox(label="Mapped sector and score")
        output_dep = gradio.outputs.Textbox(label="Mapped industry and score")
        output_other= gradio.outputs.Textbox(label="Mapped other departments/categories")
        
        with gradio.Row():
            output_keybert = gradio.outputs.Textbox(label="Identified keywords (1 word)")
            output_tags_identified = gradio.outputs.Textbox(label="Identified Tags")



    button.click(get_output,
                 [event_info],
                 outputs=[output_sec, output_dep, output_other, output_keybert, output_tags_identified])

#keyword_cluster_demo.queue().launch(share=True,debug =True, show_error =True)
keyword_cluster_demo.queue().launch()