Skip to content

Commit

Permalink
backend done
Browse files Browse the repository at this point in the history
  • Loading branch information
talha1503 committed Jul 4, 2020
1 parent 97b2b19 commit bfa0431
Show file tree
Hide file tree
Showing 88 changed files with 18,521 additions and 22 deletions.
2 changes: 1 addition & 1 deletion chrome_extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ chrome.runtime.onInstalled.addListener(function() {
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [new chrome.declarativeContent.PageStateMatcher({
pageUrl: {hostEquals: 'developer.chrome.com'},
pageUrl: {schemes: [ 'http', 'https']},
})
],
actions: [new chrome.declarativeContent.ShowPageAction()]
Expand Down
3 changes: 2 additions & 1 deletion chrome_extension/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ sendText.onclick = async function(element) {
{code: "window.getSelection().toString()"}, async function(selection){
// sel = selection[0];
var xmlhttp = new XMLHttpRequest(); // new HttpRequest instance
var theUrl = "";
var theUrl = "http://localhost:5000/get_prediction";
xmlhttp.open("POST", theUrl);
xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xmlhttp.send(JSON.stringify({ "text": selection[0] }));
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
// JSON.parse does not evaluate the attacker's scripts.
resp = JSON.parse(xmlhttp.responseText);
resp = resp['prediction']
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def create_embedding_matrix(field,embeddings):

@app.route('/form',methods=['POST','GET'])
def model_form():
return render_template('form.html')
return render_template('index.html')


@app.route('/train',methods=['POST','GET'])
Expand Down
Loading

0 comments on commit bfa0431

Please sign in to comment.