forked from mukeshrathore/SmartDoc-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
71 lines (53 loc) · 2.12 KB
/
app.py
File metadata and controls
71 lines (53 loc) · 2.12 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from flask import Flask
from flask import render_template
from flask.helpers import send_file
import os
import dotenv
from devcerts.install import ensure_certificates_are_installed
import subprocess
dotenv.load_dotenv()
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/taskpane.html")
def taskpane():
return render_template("taskpane.html")
@app.route("/commands.html")
def commands():
return render_template("commands.html")
# @app.route("/assets/icon-16.png")
# def icon16():
# return send_file("./static/assets/icon-16.png",mimetype='image/png')
# @app.route("/assets/icon-32.png")
# def icon32():
# return send_file("./static/assets/icon-32.png",mimetype='image/png')
# @app.route("/assets/icon-64.png")
# def icon64():
# return send_file("./static/assets/icon-64.png",mimetype='image/png')
# @app.route("/assets/icon-80.png")
# def icon128():
# return send_file("./static/assets/icon-80.png",mimetype='image/png')
@app.route("/assets/logo-filled.png")
def iconlogofilled():
return send_file("./static/assets/logo-filled.png",mimetype='image/png')
# @app.route('/favicon.ico')
# def favicon():
# return send_file('./static/favicon.ico', mimetype='image/vnd.microsoft.icon')
@app.route("/submit", methods=["POST"])
def submit():
print("Submit button clicked")
directory = "c:/Users/mukes/Downloads/SmartDoc/AQQkADAwATMwMAExLTg2YTctZDUxZi0wMAItMDAKABAAXYgUpp2KskWsS44VFQDFrTs="
subprocess.run(["python", "./classifile.py", directory])
return "Success", 200
if __name__ == "__main__":
if os.environ.get("APP_MODE") == "DEV":
print("Running in DEV mode")
# Call the function to ensure certificates are installed and valid
ensure_certificates_are_installed()
# Assuming the ensure_certificates_are_installed function updates the default paths as needed
from devcerts.defaults import localhost_certificate_path, localhost_key_path
ssl_context = (localhost_certificate_path, localhost_key_path)
app.run(debug=True, ssl_context=ssl_context)
else:
app.run(debug=True)