<commit_before>block variables
  - title="Image analysis demo - CloudCV"

extends layout

block content
    div.container
        h1 Image analysis example

        p You may pick one of the existing images for a quick result from the following:

        div.row
            div.col-sm-6.col-md-2
                div.thumbnail
                    img(src="/images/lena-128.png")
                    div.caption
                        form(method="post")
                            input(type="hidden",name="image",value="lena")
                            button.btn.btn-default(type="submit") Lena 
    
            div.col-sm-6.col-md-2
                div.thumbnail
                    img(src="/images/mandrill-128.png")
                    div.caption
                        form(method="post")
                            input(type="hidden",name="image",value="mandrill")
                            button.btn.btn-default(type="submit") Mandrill 

            div.col-sm-6.col-md-2
                div.thumbnail
                    img(src="/images/sudoku-128.png")
                    div.caption
                        form(method="post")
                            input(type="hidden",name="image",value="sudoku")
                            button.btn.btn-default(type="submit") Sudoku 

            //-div.col-sm-6.col-md-2
            //-    div.thumbnail
            //-        div.img-select-viewport
            //-            img(data-src="holder.js/128x128")
            //-            canvas(width="128",height="128",id="file-preview")                    
            //-            input(type="file",id="file-selector",accept="image/*")
            //-        div.caption                            
            //-            a.btn.btn-default(onclick="$('#file-selector').click();") Choose image 

        script.
            $(function() {
                $(CV).bind("imageSelected", function(image) {
                    
                    function successCallback(data, status, request)
                    {
                        console.log("Callback succeeded");
                        console.log(data);
                    }

                    $.ajax({
                        url: "/api",
                        type: "POST",
                        data: {  },
                        success: successCallback
                        });
                });
            });



        div.output(id="output")
            - if (typeof(result) !== 'undefined'){
            h2 Analyze results
            img(src="#{result.source}")
            h4 Histogram
            img(src="#{result.histogram}")
            h4 Characteristics
            ul
                li Image aspect ratio is #{result.aspectNum} : #{result.aspectDenom}<commit_msg>Added new output images for analysis example<commit_after>block variables
  - title="Image analysis demo - CloudCV"

extends layout

block content
    div.container
        h1 Image analysis example

        p You may pick one of the existing images for a quick result from the following:

        div.row
            div.col-sm-6.col-md-2
                div.thumbnail
                    img(src="/images/lena-128.png")
                    div.caption
                        form(method="post")
                            input(type="hidden",name="image",value="lena")
                            button.btn.btn-default(type="submit") Lena 
    
            div.col-sm-6.col-md-2
                div.thumbnail
                    img(src="/images/mandrill-128.png")
                    div.caption
                        form(method="post")
                            input(type="hidden",name="image",value="mandrill")
                            button.btn.btn-default(type="submit") Mandrill 

            div.col-sm-6.col-md-2
                div.thumbnail
                    img(src="/images/sudoku-128.png")
                    div.caption
                        form(method="post")
                            input(type="hidden",name="image",value="sudoku")
                            button.btn.btn-default(type="submit") Sudoku 

            //-div.col-sm-6.col-md-2
            //-    div.thumbnail
            //-        div.img-select-viewport
            //-            img(data-src="holder.js/128x128")
            //-            canvas(width="128",height="128",id="file-preview")                    
            //-            input(type="file",id="file-selector",accept="image/*")
            //-        div.caption                            
            //-            a.btn.btn-default(onclick="$('#file-selector').click();") Choose image 

        script.
            $(function() {
                $(CV).bind("imageSelected", function(image) {
                    
                    function successCallback(data, status, request)
                    {
                        console.log("Callback succeeded");
                        console.log(data);
                    }

                    $.ajax({
                        url: "/api",
                        type: "POST",
                        data: {  },
                        success: successCallback
                        });
                });
            });



        div.output(id="output")
            - if (typeof(result) !== 'undefined'){
            h2 Analyze results
            img(src="#{result.source}")
            h4 Histogram
            img(src="#{result.histogram}")
            h4 Canny edges
            img(src="#{result.canny}")
            h4 Laplaccian
            img(src="#{result.laplaccian}")
            h4 Lines
            img(src="#{result.lines}")
            h4 Characteristics
            ul
                li Image aspect ratio is #{result.aspectRatio.width} : #{result.aspectRatio.height}
{'fraction_non_alphanumeric': 0.12052957359009629, 'fraction_numerical': 0.01186382393397524, 'mean_word_length': 1.0467980295566504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5539911', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1382, 'n_words': 227}