Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -13,7 +13,7 @@ model_dir_large = 'edithram23/Redaction_Personal_info_v1'
|
|
| 13 |
tokenizer_large = AutoTokenizer.from_pretrained(model_dir_large)
|
| 14 |
model_large = AutoModelForSeq2SeqLM.from_pretrained(model_dir_large)
|
| 15 |
|
| 16 |
-
def mask_generation(text,model=model_small,tokenizer=tokenizer_small,max_len=128,max_len2
|
| 17 |
import re
|
| 18 |
inputs = ["Mask Generation: " + text]
|
| 19 |
inputs = tokenizer(inputs, max_length=max_len, truncation=True, return_tensors="pt")
|
|
@@ -39,7 +39,7 @@ async def mask_input(query):
|
|
| 39 |
if(len(query)<90):
|
| 40 |
output = mask_generation(query)
|
| 41 |
else:
|
| 42 |
-
output = mask_generation(query,model_large,tokenizer_large,512,
|
| 43 |
return {"data" : output}
|
| 44 |
|
| 45 |
if __name__ == '__main__':
|
|
|
|
| 13 |
tokenizer_large = AutoTokenizer.from_pretrained(model_dir_large)
|
| 14 |
model_large = AutoModelForSeq2SeqLM.from_pretrained(model_dir_large)
|
| 15 |
|
| 16 |
+
def mask_generation(text,model=model_small,tokenizer=tokenizer_small,max_len=128,max_len2):
|
| 17 |
import re
|
| 18 |
inputs = ["Mask Generation: " + text]
|
| 19 |
inputs = tokenizer(inputs, max_length=max_len, truncation=True, return_tensors="pt")
|
|
|
|
| 39 |
if(len(query)<90):
|
| 40 |
output = mask_generation(query)
|
| 41 |
else:
|
| 42 |
+
output = mask_generation(query,model_large,tokenizer_large,512,len(query))
|
| 43 |
return {"data" : output}
|
| 44 |
|
| 45 |
if __name__ == '__main__':
|