-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
42 lines (27 loc) · 754 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
35
36
37
38
39
40
41
42
from flask import Flask, request, render_template
from input import insert_ai
import re
import json
import threading
app = Flask(__name__)
@app.route('/', methods=['GET'])
def home():
return render_template('creatingTrip.html')
@app.route('/input', methods=['POST'])
def sum():
country = request.form['country']
state = request.form['state']
day = request.form['days']
# Start a new thread for insert_ai function
try:
insert_ai(country, state, day)
return render_template('itinerary.html')
except Exception as e:
return sum()
@app.route('/data')
def data():
with open('output.txt', 'r') as f:
data = f.read()
return data
if __name__ == '__main__':
app.run(debug=True)