Skip to content

Commit

Permalink
Updated and made it to work with basic code
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmisankepally committed Nov 25, 2019
1 parent 1791271 commit 7ee328e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from flask import Flask, flash, request, redirect, url_for
from flask import render_template, jsonify
from werkzeug.utils import secure_filename
import os
import pandas as pd
Expand Down Expand Up @@ -51,9 +52,8 @@ def upload():
return redirect(url_for('upload', filename=filename))

return '''
<!doctype html>
<title>Upload new File</title>
<h1>Upload new File</h1>
<p>Upload new File</p>
<form method=post enctype=multipart/form-data>
<input type=file name=file>
<input type=submit value=Upload>
Expand Down Expand Up @@ -127,7 +127,7 @@ def experiment(experiment_id):

@app.route('/')
def hello():
return 'Hello!'
return render_template('viz.html')


def experiment_list():
Expand Down
12 changes: 9 additions & 3 deletions src/static/IRViz.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<script>
var uploadDiv = document.getElementById('upload');
$.get("/upload", function(data) {
console.log(data);
uploadDiv.innerHTML=data;
})

var graphDiv = document.getElementById('tester'),
data = [{x: [], y:[]}],
layout = {};


Plotly.newPlot(graphDiv, data, layout);

$.get("/data", function(data){
Expand Down Expand Up @@ -41,6 +47,7 @@ $(document).ready(function() {
$("select").on('change', function(event){
var yearvalue = document.getElementById("year-value").value;
var dataToBeSent = document.getElementById("mySelect").value;

$.ajax({
type: "POST",
url: "send_data",
Expand All @@ -57,5 +64,4 @@ console.log(error);
}
});
});
});
</script>
});
11 changes: 5 additions & 6 deletions src/templates/viz.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.0/js/ion.rangeSlider.min.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.0/css/ion.rangeSlider.min.css"/>
<script type="text/javascript" src="{{ url_for('static', filename='IRViz.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>

<div class = "ex1">

<div id="upload">abc</div>

<div class = "ex1">
<select id="mySelect">
<option>MAP</option>
<option>nDCG</option>
</select>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<input type="text" id="range-value" value="2002" class="autoupdate"/>
<input type="submit" value="Submit">
</div>

<div id="tester"></div>

<div id="topslider"></div>

<script type="text/javascript" src="{{ url_for('static', filename='IRViz.js') }}"></script>
</html>

0 comments on commit 7ee328e

Please sign in to comment.