atlas / text_tools.py
ANISA09's picture
Rename text_utils.py to text_tools.py
ea2977b verified
raw
history blame contribute delete
543 Bytes
from transformers import pipeline
from config import *
summarizer = zero_shot = None
def init_text_tools():
global summarizer, zero_shot
try:
summarizer = pipeline("summarization", model=HF_SUMMARIZER)
except Exception as e:
logger.warning("Could not load summarizer: %s", e)
try:
zero_shot = pipeline("zero-shot-classification", model=HF_ZERO_SHOT)
except Exception as e:
logger.warning("Could not load zero-shot classifier: %s", e)
init_text_tools()
def extract_claim_from_text(text