Skip to content

Commit 9f66cba

Browse files
authored
Update flaskrestapi.py
1 parent 0001683 commit 9f66cba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

flaskrestapi.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
"""
3-
This is the Flask REST API that processed and outputs the prediction on the URL.
3+
This is the Flask REST API that processes and outputs the prediction on the URL.
44
"""
55
import numpy as np
66
from keras.models import load_model
@@ -11,10 +11,9 @@
1111
import flask
1212
import json
1313

14-
# Initialize our Flask application and the Keras model
14+
# Initialize our Flask application and the Keras model.
1515
app = flask.Flask(__name__)
1616

17-
1817
global graph
1918
graph = tf.get_default_graph()
2019
model_pre = 'bi-lstmchar256256128.h5'
@@ -53,6 +52,7 @@ def predict():
5352

5453
# Check if POST request.
5554
if flask.request.method == "POST":
55+
5656
# Grab and process the incoming json.
5757
incoming = flask.request.get_json()
5858
urlz = []
@@ -83,7 +83,7 @@ def predict():
8383
if "/" not in split2:
8484
result = "Base URLs cannot be accurately determined."
8585

86-
# Process prediction probability into something human-friendly.
86+
# Processes prediction probability.
8787
prediction = float(prediction)
8888
prediction = prediction * 100
8989

0 commit comments

Comments
 (0)