

Now we change the function definition a little, now the function takes two parameters, the first is the file and the other is the code format. We pass this colour code to our function, which returns a list of colour codes. The name of this argument will be used on the front end to access the data it holds.Īny input field data is accessed through the request.form, which is a dictionary, where keys are names of input fields holding the data that the user entered for that input key.

Dynamic data is provided to the flask rendered frontend by giving data as an argument in the render_template method.
Get website color palette from image update#
Once the function has done its evaluation and returned us a list of colour codes of the top 10 occurring colours, we update the front end with this list of colours. The file is not sent wholely over the internet, it is sent in chunks of data, and we read these chunks using this stream property. We pass the file to the function by using its stream property. We access files sent from the user, using request.files. If the method is not POST, then simply render the frontend, if the method is POST, we pass our image file to a function that evaluates it. We give it an array of methods that we want to make available. GET is the default method, available on a route, but to make other methods available on the route, we must set the method’s argument of the decorator function. The request object import from the Flask is used to check what is the method for the route. ISRO CS Syllabus for Scientist/Engineer Exam.

ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.DevOps Engineering - Planning to Production.Python Backend Development with Django(Live).Android App Development with Kotlin(Live).Full Stack Development with React & Node JS(Live).Java Programming - Beginner to Advanced.Data Structure & Algorithm-Self Paced(C++/JAVA).Data Structures & Algorithms in JavaScript.Data Structure & Algorithm Classes (Live).
