-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
34 lines (32 loc) · 882 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from flask import Flask
from flask import render_template, request
from flask_restful import Api
from flask_cors import CORS
import pyswip
from pyswip import Prolog
import json
import os.path
import logging
from src.handledata import handle_response_code
from src.thesis import GetData
from src.witeonfile import chartbig1
# ------------------------------------------------------------------------------
app = Flask(__name__)
# for develop
app.debug = True
api = Api(app)
CORS(app)
# for develop
logging.basicConfig(level = logging.INFO)
# thesis
api.add_resource(GetData, '/getData') # get
@app.route("/")
def home():
return render_template("index.html")
@app.route("/getdata")
def get_bot_response():
userText = str(request.args.get('data'))
message_chatbot = handle_response_code(userText)
return message_chatbot
if __name__ == "__main__":
app.run(port=8000)