This file contains 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
def get_gradient(question, context, model, tokenizer): | |
"""Return gradient of input (question) wrt to model output span prediction | |
Args: | |
question (str): text of input question | |
context (str): text of question context/passage | |
model (QA model): Hugging Face BERT model for QA transformers.modeling_tf_distilbert.TFDistilBertForQuestionAnswering, transformers.modeling_tf_bert.TFBertForQuestionAnswering | |
tokenizer (tokenizer): transformers.tokenization_bert.BertTokenizerFast | |
Returns: |
This file contains 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
\\ npm install --save handtrackjs | |
import * as handTrack from 'handtrackjs'; | |
const img = document.getElementById('img'); | |
// Load the model. | |
const img = document.getElementById('img'); | |
handTrack.load().then(model => { | |
model.detect(img).then(predictions => { |
This file contains 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
<script src="https://cdn.jsdelivr.net/npm/handtrackjs/dist/handtrack.min.js"> </script> | |
const img = document.getElementById('img'); | |
// Load the model. | |
const img = document.getElementById('img'); | |
handTrack.load().then(model => { | |
model.detect(img).then(predictions => { | |
console.log('Predictions: ', predictions) // bbox predictions | |
}); | |
}); |