Update main.py
Browse files
main.py
CHANGED
|
@@ -25,23 +25,15 @@ def get():
|
|
| 25 |
data = query({"inputs": "The movie is good"})
|
| 26 |
return data
|
| 27 |
|
| 28 |
-
@app.route(
|
| 29 |
-
def
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
# def home():
|
| 41 |
-
# print(1)
|
| 42 |
-
# return {'key':"Hello HuggingFace! Successfully deployed. "}
|
| 43 |
-
# # model = load_checkpoint('checkpoint.pth')
|
| 44 |
-
# # print(2)
|
| 45 |
-
# # res = sample(model, obj.maxlen, 'ap')
|
| 46 |
-
# # print(3)
|
| 47 |
-
# # return {'key':res}
|
|
|
|
| 25 |
data = query({"inputs": "The movie is good"})
|
| 26 |
return data
|
| 27 |
|
| 28 |
+
@app.route("/", methods=["GET", "POST"])
|
| 29 |
+
def index():
|
| 30 |
+
user_input = None
|
| 31 |
+
response = None
|
| 32 |
+
|
| 33 |
+
if request.method == "POST":
|
| 34 |
+
user_input = request.form.get("user_input")
|
| 35 |
+
response = query({"inputs": user_input})
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
return render_template("index.html", user_input=user_input, response=response)
|
| 39 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|