MVC architecture connections¶
This is a short description of the code belonging to the plumbing between frontend and backend
The code in this file is mainly plumbing between the frontend and ML backend. It consists of routes which map to the browser url. We use the MVC architechture where we code the controller and modals. View manager in our code is Jinga2vec
-
async
main.
contrbPage
(request)¶ This function gives people the option to contribute the essay set and make the model better.
>>> Essay: Hi, this is the festival of diwali and I like to enjoy it with my friends and pet cow
>>> Score: 30/100
-
async
main.
evaluate
(request)¶ The function evaluate: stores the user input essay and corresponding score We have two calls of function evaluate with the distinction of the routes with totally different route.
@app.route('/evaluate',methods=["POST"])
This sends the essay to the server and recieves the score after some calculation.
@app.route('/contribute',methods=["POST"])
This is to store the essay and score pair provided by the user and appreciate the wholsomeness of it
-
async
main.
evaluateFile
(request)¶ This funicton gives us a method to get the text out of file directly. Intead of writing text, it is better to upload text.
We see the function on a route
@app.route('/evaluateFile',methods=["POST"])
-
async
main.
firebase_login
(request)¶ This function deals with authentication in the code
- Param
request
- Return type
Templating engine for Python3 rendering
>>> cool@cool.com and coolcool
-
async
main.
firebase_register
(request)¶ This function registers us on the firebase platform.
It accepts user input from UI, ie. The email and password
The route for the same would be
@app.route('/registration',methods=["POST"])
-
async
main.
getEssay
(request)¶ This function getEssay is here to give us access to the cloud hosted url whenever. We can now check about donated essays till now. This controller operates on route
@app.route('/{prompt}')
-
async
main.
login
(request)¶ For the controller Login, we have two different routes
@app.route('/')
, This is invoked when we have a redirect to and from the default start state or direct home href links
2)
@app.route('/register')
We get here when it’s the login link vi This function gives us the ability of logging in if our username and pass match
-
async
main.
show_index
(request)¶ The function is a controller. It is invoked when we call
/auth