Last active
June 15, 2020 08:45
-
-
Save caleb-kaiser/f6f86c20900df7ca3b6e4ec4d912b0fc 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