Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,11 +27,11 @@ def call(sentence, detection_threshold):
|
|
27 |
outputs = pipeline([sentence], nominalization_detection_threshold=detection_threshold)[0]
|
28 |
def pretty_qadisc_qas(qa_infos) -> List[str]:
|
29 |
if not qa_infos: return []
|
30 |
-
return [
|
31 |
for qa in qa_infos if qa is not None]
|
32 |
def pretty_qasrl_qas(pred_info) -> List[str]:
|
33 |
if not pred_info or not pred_info['QAs']: return []
|
34 |
-
return [
|
35 |
for qa in pred_info['QAs'] if qa is not None]
|
36 |
qasrl_qas = [qa for pred_info in outputs['qasrl'] for qa in pretty_qasrl_qas(pred_info)]
|
37 |
qanom_qas = [qa for pred_info in outputs['qanom'] for qa in pretty_qasrl_qas(pred_info)]
|
|
|
27 |
outputs = pipeline([sentence], nominalization_detection_threshold=detection_threshold)[0]
|
28 |
def pretty_qadisc_qas(qa_infos) -> List[str]:
|
29 |
if not qa_infos: return []
|
30 |
+
return ["- " + f"{qa['question']} --- {qa['answer']}".lstrip()
|
31 |
for qa in qa_infos if qa is not None]
|
32 |
def pretty_qasrl_qas(pred_info) -> List[str]:
|
33 |
if not pred_info or not pred_info['QAs']: return []
|
34 |
+
return ["- " + f"{qa['question']} --- {';'.join(qa['answers'])}".lstrip()
|
35 |
for qa in pred_info['QAs'] if qa is not None]
|
36 |
qasrl_qas = [qa for pred_info in outputs['qasrl'] for qa in pretty_qasrl_qas(pred_info)]
|
37 |
qanom_qas = [qa for pred_info in outputs['qanom'] for qa in pretty_qasrl_qas(pred_info)]
|