forked from KamelMoohamed/Nasa-Space-Apps-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
35 lines (24 loc) · 831 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
import os
import atexit
from flask import Flask, render_template, Response, request
from data_predication import DataPredication
from data_generator import DataGenerator
from apscheduler.schedulers.background import BackgroundScheduler
app = Flask(__name__, template_folder="templetes")
@app.route('/', methods=['GET'])
def index():
return render_template('homeclass.html')
@app.route('/predication', methods=['POST', 'GET'])
def predict():
d = DataPredication()
data = d.predict()
return data[0]
def update_data():
scheduler = BackgroundScheduler()
generator = DataGenerator()
scheduler.add_job(func=generator.generate, trigger="interval", days=1)
scheduler.start()
atexit.register(lambda: scheduler.shutdown())
if __name__ == '__main__':
# update_data()
app.run(debug=True)