Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -46,6 +46,7 @@ def id_replace_complex(s, threshold=0.4):
|
|
46 |
|
47 |
def generate_candidate_text(s, model, tokenizer, tokenized=False):
|
48 |
|
|
|
49 |
out = simpl_tok([s], max_length=256, padding="max_length", truncation=True,
|
50 |
return_tensors='pt') if not tokenized else s
|
51 |
|
@@ -71,11 +72,8 @@ def rank_candidate_text(sentences):
|
|
71 |
|
72 |
def full_pipeline(source, simpl_model, simpl_tok, tokens, lexical=False):
|
73 |
|
74 |
-
modified, complex_words
|
75 |
-
|
76 |
-
|
77 |
-
print(modified)
|
78 |
-
cands = generate_candidate_text(tokens+modified, simpl_model, simpl_tok)
|
79 |
output = rank_candidate_text(cands)
|
80 |
return output, complex_words
|
81 |
|
|
|
46 |
|
47 |
def generate_candidate_text(s, model, tokenizer, tokenized=False):
|
48 |
|
49 |
+
|
50 |
out = simpl_tok([s], max_length=256, padding="max_length", truncation=True,
|
51 |
return_tensors='pt') if not tokenized else s
|
52 |
|
|
|
72 |
|
73 |
def full_pipeline(source, simpl_model, simpl_tok, tokens, lexical=False):
|
74 |
|
75 |
+
modified, complex_words = id_replace_complex(source, threshold=0.2) if lexical else (source, None)
|
76 |
+
cands = generate_candidate_text(tokens+modified simpl_model, simpl_tok)
|
|
|
|
|
|
|
77 |
output = rank_candidate_text(cands)
|
78 |
return output, complex_words
|
79 |
|