Alain Vaucher
commited on
Commit
•
e49cab3
1
Parent(s):
400d3d5
Additional logs
Browse files
app.py
CHANGED
@@ -65,13 +65,19 @@ def sentence_and_actions_to_html(
|
|
65 |
|
66 |
|
67 |
def try_action_extraction(model_type: str, text: str, show_sentences: bool) -> str:
|
68 |
-
logger.info(f'Extracting actions from paragraph "{textwrap.shorten(text, 60)}"
|
69 |
|
70 |
download_cde_data()
|
71 |
|
72 |
model = load_model(model_type)
|
|
|
|
|
73 |
sentences = split_into_sentences(text)
|
|
|
|
|
|
|
74 |
action_strings = model.translate(sentences)
|
|
|
75 |
|
76 |
output = ""
|
77 |
for sentence, action_string in zip(sentences, action_strings):
|
@@ -85,6 +91,9 @@ def try_action_extraction(model_type: str, text: str, show_sentences: bool) -> s
|
|
85 |
# PostTreatment was renamed to ThermalTreatment, old model still relies on the former
|
86 |
output = output.replace("POSTTREATMENT", "THERMALTREATMENT")
|
87 |
|
|
|
|
|
|
|
88 |
return output
|
89 |
|
90 |
|
|
|
65 |
|
66 |
|
67 |
def try_action_extraction(model_type: str, text: str, show_sentences: bool) -> str:
|
68 |
+
logger.info(f'Extracting actions from paragraph "{textwrap.shorten(text, 60)}"...')
|
69 |
|
70 |
download_cde_data()
|
71 |
|
72 |
model = load_model(model_type)
|
73 |
+
|
74 |
+
logger.info(f"Splitting paragraph into sentences...")
|
75 |
sentences = split_into_sentences(text)
|
76 |
+
logger.info(f"Splitting paragraph into sentences... Done.")
|
77 |
+
|
78 |
+
logger.info(f"Translation with OpenNMT...")
|
79 |
action_strings = model.translate(sentences)
|
80 |
+
logger.info(f"Translation with OpenNMT... Done.")
|
81 |
|
82 |
output = ""
|
83 |
for sentence, action_string in zip(sentences, action_strings):
|
|
|
91 |
# PostTreatment was renamed to ThermalTreatment, old model still relies on the former
|
92 |
output = output.replace("POSTTREATMENT", "THERMALTREATMENT")
|
93 |
|
94 |
+
logger.info(
|
95 |
+
f'Extracting actions from paragraph "{textwrap.shorten(text, 60)}"... Done.'
|
96 |
+
)
|
97 |
return output
|
98 |
|
99 |
|