
import pandas as pd

from sagemaker.pytorch.model import PyTorchPredictor
from sagemaker.deserializers import JSONDeserializer
from sagemaker.serializers import JSONSerializer
from sagemaker.predictor_async import AsyncPredictor
from sagemaker.predictor import Predictor


def call_label_generator(endpoint_key, question, sentences):
    
    data = {"questions": ["theft"],
                 "sentences" : sentences}
    
    predictor = Predictor(endpoint_name=endpoint_key, serializer=JSONSerializer(), deserializer=JSONDeserializer())
    async_predictor = AsyncPredictor(predictor)
    
    
    result = async_predictor.predict_async(data, "s3://ask-t5-stage/async_inference/ip")
    return result

