harshithakr commited on
Commit
dcf2a73
·
1 Parent(s): 832f6e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -2,12 +2,15 @@ import gradio
2
  from kbert_topics import extract_topics
3
  from mapping import get_mapping
4
  from topics_extraction import classify
 
 
5
 
6
 
7
  def get_output(event_info):
8
  if len(event_info.split(' '))>=20:
9
  topic_name, distance_name, topic_name_other, distance_name_other = get_mapping(event_info)
10
  work_list = extract_topics(event_info)
 
11
  return topic_name+ ' '+str(distance_name), str(topic_name_other) + ' '+str(distance_name_other), str(work_list),classify(event_info)
12
  else:
13
  return 'Event discription should have >= 20 words', None, None,None
 
2
  from kbert_topics import extract_topics
3
  from mapping import get_mapping
4
  from topics_extraction import classify
5
+ from PyDictionary import PyDictionary
6
+ dictionary=PyDictionary()
7
 
8
 
9
  def get_output(event_info):
10
  if len(event_info.split(' '))>=20:
11
  topic_name, distance_name, topic_name_other, distance_name_other = get_mapping(event_info)
12
  work_list = extract_topics(event_info)
13
+ work_list = [i for i in work_list if bool(dictionary.meaning(i))])
14
  return topic_name+ ' '+str(distance_name), str(topic_name_other) + ' '+str(distance_name_other), str(work_list),classify(event_info)
15
  else:
16
  return 'Event discription should have >= 20 words', None, None,None