From c5fc2f7c70d0966cdb15f3bd54f93e867a37114e Mon Sep 17 00:00:00 2001 From: rnarula2 Date: Sun, 8 Oct 2023 13:39:18 -0400 Subject: [PATCH 01/78] created static folder --- Code/recommenderapp/static/index.js | 115 ++++++++++ .../templates/landing_page.html | 210 +++++++++--------- requirements.txt | 38 +++- 3 files changed, 254 insertions(+), 109 deletions(-) create mode 100644 Code/recommenderapp/static/index.js diff --git a/Code/recommenderapp/static/index.js b/Code/recommenderapp/static/index.js new file mode 100644 index 000000000..13b05ba85 --- /dev/null +++ b/Code/recommenderapp/static/index.js @@ -0,0 +1,115 @@ +$(document).ready(function () { + + $(function () { + $("#searchBox").autocomplete({ + source: function (request, response) { + $.ajax({ + type: "POST", + url: "http://localhost:5000/search", + dataType: "json", + cache: false, + data: { + q: request.term + }, + success: function (data) { + //alert(data); + // console.log(data); + response(data); + }, + error: function (jqXHR, textStatus, errorThrown) { + console.log(textStatus + " " + errorThrown); + } + }); + }, + select: function (event, ui) { + var ulList = $('#selectedMovies'); + var li = $('
  • ').text(ui.item.value).appendTo(ulList); + $('#searchBox').val(""); + return false; + }, + minLength: 2 + }); + }); + + $("#predict").click( function(){ + var movie_list = [] + + $('#selectedMovies li').each( function () { + movie_list.push($(this).text()); + }); + + var movies = {"movie_list": movie_list}; + + $.ajax({ + type: "POST", + url: "/predict", + dataType: "json", + contentType: "application/json;charset=UTF-8", + traditional: "true", + cache: false, + data: JSON.stringify(movies), + success: function (response) { + var ulList = $('#predictedMovies'); + var i = 0; + response['recommendations'].forEach(element => { + var diventry = $('
    '); + var fieldset = $('
    ', {id:i}).css("border",'0'); + var li = $('
  • ').text(element); + var radios = $(" \ + \ +

    "); + diventry.append(li); + diventry.append(radios); + fieldset.append(diventry); + ulList.append(fieldset); + i+=1; + }); + + // var li = $('
  • ').text() + console.log("->", response['recommendations']); + }, + error: function (error) { + console.log("ERROR ->" + error ); + } + }); + }); + + $('#feedback').click(function(){ + var myForm = $('fieldset'); + var data = {}; + var labels = { + 1: 'Dislike', + 2: 'Yet to watch', + 3: 'Like' + }; + for(var i=0;i", response); + // $("#dataCollected").css("display", "block"); + window.location.href="/success"; + }, + error: function (error) { + console.log("ERROR ->" + error ); + } + }); + + }); + + +}); + +console.log("Hello World!!!") diff --git a/Code/recommenderapp/templates/landing_page.html b/Code/recommenderapp/templates/landing_page.html index e4f546689..7f2e1fba6 100644 --- a/Code/recommenderapp/templates/landing_page.html +++ b/Code/recommenderapp/templates/landing_page.html @@ -8,8 +8,11 @@ + + + @@ -52,122 +55,121 @@

    Thanks!! Your response was stored. - --> \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index c7d34143f..d5337af0d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,33 @@ -numpy==1.18.5 -pandas==1.0.4 -Flask==1.1.2 -Flask-Cors==3.0.9 -autopep8==1.5.4 \ No newline at end of file +autopep8==2.0.4 +black==23.9.1 +blinker==1.6.2 +certifi==2023.7.22 +charset-normalizer==3.2.0 +click==8.1.7 +cPython==0.0.6 +dnspython==2.4.2 +Flask==2.3.3 +Flask-Cors==4.0.0 +idna==3.4 +importlib-metadata==6.8.0 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.3 +mypy-extensions==1.0.0 +numpy==1.25.2 +packaging==23.1 +pandas==2.1.0 +pathspec==0.11.2 +platformdirs==3.10.0 +pycodestyle==2.11.0 +pymongo==4.5.0 +python-dateutil==2.8.2 +pytz==2023.3.post1 +requests==2.31.0 +six==1.16.0 +tomli==2.0.1 +typing_extensions==4.7.1 +tzdata==2023.3 +urllib3==2.0.4 +Werkzeug==2.3.7 +zipp==3.16.2 \ No newline at end of file From 9e15d9ef75d04c32eb8d36aa825e845f937b4312 Mon Sep 17 00:00:00 2001 From: rnarula2 Date: Sun, 8 Oct 2023 13:46:13 -0400 Subject: [PATCH 02/78] linked static to html --- Code/recommenderapp/templates/landing_page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/recommenderapp/templates/landing_page.html b/Code/recommenderapp/templates/landing_page.html index 7f2e1fba6..d2fced129 100644 --- a/Code/recommenderapp/templates/landing_page.html +++ b/Code/recommenderapp/templates/landing_page.html @@ -12,7 +12,7 @@ - + From 3c4f13020cfae9a16dfcd1da97c9766d272e29a9 Mon Sep 17 00:00:00 2001 From: rnarula2 Date: Sun, 8 Oct 2023 14:03:57 -0400 Subject: [PATCH 03/78] changes --- .../templates/landing_page.html | 230 +++++++++--------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/Code/recommenderapp/templates/landing_page.html b/Code/recommenderapp/templates/landing_page.html index d2fced129..ce4f177cf 100644 --- a/Code/recommenderapp/templates/landing_page.html +++ b/Code/recommenderapp/templates/landing_page.html @@ -1,18 +1,16 @@ - - - What movies do you like? - - - - - - - - - - + + + What movies do you like? + + + + + + + + @@ -55,118 +53,120 @@

    Thanks!! Your response was stored. - + +

    -
    +

    Please select movies for training

    -

    +

      

    -
    +

    Selected movies :

      -
    -
    +
    -
    -
    +

    Predicted Movies

      -
    -
    -
    + -
    + +

    Thanks!! Your response was stored.

    +


    From 3884fe2bba1b379e2d17c989ce2f6296d0af9379 Mon Sep 17 00:00:00 2001 From: Atharva Thorve Date: Sun, 8 Oct 2023 15:09:38 -0400 Subject: [PATCH 06/78] Fixed landing page --- .../templates/landing_page.html | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/Code/recommenderapp/templates/landing_page.html b/Code/recommenderapp/templates/landing_page.html index cf7b2a1c0..7088d33d3 100644 --- a/Code/recommenderapp/templates/landing_page.html +++ b/Code/recommenderapp/templates/landing_page.html @@ -1,54 +1,61 @@ - - - What movies do you like? - - - - - - - - - - + + + What movies do you like? + + + + + + + + + + + + + +

    -
    +

    Please select movies for training

    -

    +

      

    -
    +

    Selected movies :

      +
    -
    +
    +
    -
    +

    Predicted Movies

      +
    +
    -