Spaces:
Runtime error
Runtime error
Commit ·
10ff21c
1
Parent(s): 8cd76cf
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,9 +9,16 @@ dictionary=PyDictionary()
|
|
| 9 |
def get_output(event_info):
|
| 10 |
if len(event_info.split(' '))>=20:
|
| 11 |
topic_name, distance_name,topic_name_dep, distance_name_dep,tags_list = get_mapping(event_info)
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
return topic_name+ ' '+str(distance_name), str(topic_name_dep) + ' '+str(distance_name_dep),tags_list, str(work_list), str(others)
|
| 16 |
else:
|
| 17 |
return 'Event discription should have >= 20 words', None, None, None,None
|
|
@@ -35,11 +42,11 @@ with gradio.Blocks(theme = 'gradio/monochrome', title = 'Keyword clustering Demo
|
|
| 35 |
|
| 36 |
output_sec = gradio.outputs.Textbox(label="Mapped sector and score")
|
| 37 |
output_dep = gradio.outputs.Textbox(label="Mapped industry and score")
|
| 38 |
-
output_tags= gradio.outputs.Textbox(label="Identified tags")
|
| 39 |
|
| 40 |
with gradio.Row():
|
| 41 |
output_keybert = gradio.outputs.Textbox(label="Identified keywords (1 word)")
|
| 42 |
-
output_other_tags = gradio.outputs.Textbox(label="Identified other tags")
|
| 43 |
|
| 44 |
|
| 45 |
|
|
|
|
| 9 |
def get_output(event_info):
|
| 10 |
if len(event_info.split(' '))>=20:
|
| 11 |
topic_name, distance_name,topic_name_dep, distance_name_dep,tags_list = get_mapping(event_info)
|
| 12 |
+
if distance_name!=None:
|
| 13 |
+
sectors = topic_name + topic_name_dep
|
| 14 |
+
flat_list = [item.strip() for sublist in [x.split(' ') for x in sectors] for item in sublist]
|
| 15 |
+
others = [x for x in tags if x not in flat_list]
|
| 16 |
+
work_list = None
|
| 17 |
+
else:
|
| 18 |
+
others = []
|
| 19 |
+
work_list, keywords_2 = extract_topics(event_info)
|
| 20 |
+
work_list = [i for i in work_list if bool(dictionary.meaning(i))]
|
| 21 |
+
|
| 22 |
return topic_name+ ' '+str(distance_name), str(topic_name_dep) + ' '+str(distance_name_dep),tags_list, str(work_list), str(others)
|
| 23 |
else:
|
| 24 |
return 'Event discription should have >= 20 words', None, None, None,None
|
|
|
|
| 42 |
|
| 43 |
output_sec = gradio.outputs.Textbox(label="Mapped sector and score")
|
| 44 |
output_dep = gradio.outputs.Textbox(label="Mapped industry and score")
|
| 45 |
+
output_tags= gradio.outputs.Textbox(label="Identified tags (All)")
|
| 46 |
|
| 47 |
with gradio.Row():
|
| 48 |
output_keybert = gradio.outputs.Textbox(label="Identified keywords (1 word)")
|
| 49 |
+
output_other_tags = gradio.outputs.Textbox(label="Identified other tags (not in sector /industry) ")
|
| 50 |
|
| 51 |
|
| 52 |
|