Update app.py
Browse files
app.py
CHANGED
@@ -68,23 +68,23 @@ def generate_relations(text, entity1, entity2):
|
|
68 |
modelOut = response[len(prompt):].strip() # remove prompt from output if echoed
|
69 |
answer_match = answer_label_regex_pattern.search(modelOut)
|
70 |
if answer_match:
|
71 |
-
if answer_match.group(1)=='0'
|
72 |
return f"""{entity1} causes {entity2}"""
|
73 |
-
elif answer_match.group(1)=='1'
|
74 |
return f"""{entity2} causes {entity1}"""
|
75 |
-
elif answer_match.group(1)=='2'
|
76 |
return f"""{entity1} enables {entity2}"""
|
77 |
-
elif answer_match.group(1)=='3'
|
78 |
return f"""{entity2} enables {entity1}"""
|
79 |
-
elif answer_match.group(1)=='4'
|
80 |
return f"""{entity1} prevents {entity2}"""
|
81 |
-
elif answer_match.group(1)=='5'
|
82 |
return f"""{entity2} prevents {entity1}"""
|
83 |
-
elif answer_match.group(1)=='6'
|
84 |
return f"""{entity1} hinders {entity2}"""
|
85 |
-
elif answer_match.group(1)=='7'
|
86 |
return f"""{entity2} hinders {entity1}"""
|
87 |
-
elif answer_match.group(1)=='8'
|
88 |
return f"""No causal relation between {entity1} and {entity2}"""
|
89 |
else:
|
90 |
return 'No causal relation could be extracted'
|
|
|
68 |
modelOut = response[len(prompt):].strip() # remove prompt from output if echoed
|
69 |
answer_match = answer_label_regex_pattern.search(modelOut)
|
70 |
if answer_match:
|
71 |
+
if answer_match.group(1)=='0':
|
72 |
return f"""{entity1} causes {entity2}"""
|
73 |
+
elif answer_match.group(1)=='1':
|
74 |
return f"""{entity2} causes {entity1}"""
|
75 |
+
elif answer_match.group(1)=='2':
|
76 |
return f"""{entity1} enables {entity2}"""
|
77 |
+
elif answer_match.group(1)=='3':
|
78 |
return f"""{entity2} enables {entity1}"""
|
79 |
+
elif answer_match.group(1)=='4':
|
80 |
return f"""{entity1} prevents {entity2}"""
|
81 |
+
elif answer_match.group(1)=='5':
|
82 |
return f"""{entity2} prevents {entity1}"""
|
83 |
+
elif answer_match.group(1)=='6':
|
84 |
return f"""{entity1} hinders {entity2}"""
|
85 |
+
elif answer_match.group(1)=='7':
|
86 |
return f"""{entity2} hinders {entity1}"""
|
87 |
+
elif answer_match.group(1)=='8':
|
88 |
return f"""No causal relation between {entity1} and {entity2}"""
|
89 |
else:
|
90 |
return 'No causal relation could be extracted'
|