-
-
Save minesh1291/c3bd85b3e644a6995a84c95fd323bd27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from allennlp.predictors.predictor import Predictor as AllenNLPPredictor | |
| class Predictor: | |
| def __init__(self, config): | |
| self.predictor = AllenNLPPredictor.from_path( | |
| "https://storage.googleapis.com/allennlp-public-models/bidaf-elmo-model-2018.11.30-charpad.tar.gz" | |
| ) | |
| def predict(self, payload): | |
| prediction = self.predictor.predict( | |
| passage=payload["passage"], question=payload["question"] | |
| ) | |
| return prediction["best_span_str"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment