Sa-m commited on
Commit
b846e8e
·
1 Parent(s): 22b06d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -9,8 +9,9 @@ from PIL import Image
9
  from waitress import serve
10
  import subprocess
11
  import argparse
 
12
 
13
-
14
  #subprocess.run(["export", "FLASK_APP","=","app.py"])
15
  app = Flask(__name__)
16
 
@@ -35,14 +36,30 @@ def predict():
35
  results=results.pandas().xyxy[0].to_json(orient="records")
36
  return f"{results}"
37
 
38
- '''
39
  if __name__ == "__main__":
40
 
41
  #subprocess.run(["export","FLASK_ENV","=","development"])
42
  app.run(host="0.0.0.0", port=7860) # debug=True causes Restarting with stat
43
  #serve(app, host="0.0.0.0", port=7860)
44
- '''
45
  if __name__ == "__main__":
46
 
47
  model = torch.hub.load('ultralytics/yolov5', 'custom', path='best2.pt', force_reload=True) # force_reload to recache
48
  app.run(host="0.0.0.0", port=7860,debug =True) # debug=True causes Restarting with stat
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  from waitress import serve
10
  import subprocess
11
  import argparse
12
+ import os
13
 
14
+ '''
15
  #subprocess.run(["export", "FLASK_APP","=","app.py"])
16
  app = Flask(__name__)
17
 
 
36
  results=results.pandas().xyxy[0].to_json(orient="records")
37
  return f"{results}"
38
 
39
+
40
  if __name__ == "__main__":
41
 
42
  #subprocess.run(["export","FLASK_ENV","=","development"])
43
  app.run(host="0.0.0.0", port=7860) # debug=True causes Restarting with stat
44
  #serve(app, host="0.0.0.0", port=7860)
45
+
46
  if __name__ == "__main__":
47
 
48
  model = torch.hub.load('ultralytics/yolov5', 'custom', path='best2.pt', force_reload=True) # force_reload to recache
49
  app.run(host="0.0.0.0", port=7860,debug =True) # debug=True causes Restarting with stat
50
+ '''
51
+
52
+
53
+
54
+ app = Flask(__name__)
55
+
56
+
57
+ @app.route('/')
58
+ def index():
59
+ return '<iframe frameBorder="0" height="100%" src="{}/?__dark-theme={}" width="100%"></iframe>'.format(
60
+ os.getenv('INACCEL_URL'),
61
+ flask.request.args.get('__dark-theme', 'false'))
62
+
63
+
64
+ if __name__ == '__main__':
65
+ app.run(host='0.0.0.0', port=7860)