Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -164,7 +164,23 @@ def run_short_extraction(article, number_of_paraphrases):
|
|
164 |
st.error('Error running Extraction Pipeline. Please contact admin')
|
165 |
logger.error(traceback.format_exc())
|
166 |
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
kw_extractor, t5_model, t5_tokenizer = load_base_model()
|
170 |
|
|
|
164 |
st.error('Error running Extraction Pipeline. Please contact admin')
|
165 |
logger.error(traceback.format_exc())
|
166 |
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
def check_document_length(article, number_of_paraphrases):
|
171 |
+
total_tokens = len(t5_tokenizer.encode(article))
|
172 |
+
st.info(f'Token Counts for Encoded Document: {total_tokens}')
|
173 |
+
|
174 |
+
if total_tokens >= 512:
|
175 |
+
st.info('Running Extraction for Long Document')
|
176 |
+
t5_keywords_df, original_keywords_df, unique_keywords_df, total_end = run_long_extraction(article, number_of_paraphrases)
|
177 |
+
else:
|
178 |
+
st.info('Running Extraction for Short Document')
|
179 |
+
t5_keywords_df, original_keywords_df, unique_keywords_df, total_end = run_short_extraction(article, number_of_paraphrases)
|
180 |
+
|
181 |
+
return t5_keywords_df, original_keywords_df, unique_keywords_df, total_end
|
182 |
+
|
183 |
+
|
184 |
|
185 |
kw_extractor, t5_model, t5_tokenizer = load_base_model()
|
186 |
|