DmitrMakeev commited on
Commit
ed8c51f
·
verified ·
1 Parent(s): 109bade

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -5
app.py CHANGED
@@ -13,10 +13,6 @@ socketio = SocketIO(app)
13
  if not os.path.exists(UPLOAD_FOLDER):
14
  os.makedirs(UPLOAD_FOLDER)
15
 
16
- @app.route('/online', methods=['GET'])
17
- def online():
18
- return render_template('online.html')
19
-
20
  @app.route('/upload', methods=['POST'])
21
  def upload_file():
22
  if 'photo' not in request.files:
@@ -56,6 +52,28 @@ def index():
56
  '''
57
  return render_template_string(html)
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  @socketio.on('message')
60
  def handle_message(msg):
61
  print('Message: ' + msg)
@@ -68,4 +86,3 @@ def handle_json(json):
68
 
69
  if __name__ == '__main__':
70
  socketio.run(app, host='0.0.0.0', port=7860, allow_unsafe_werkzeug=True)
71
-
 
13
  if not os.path.exists(UPLOAD_FOLDER):
14
  os.makedirs(UPLOAD_FOLDER)
15
 
 
 
 
 
16
  @app.route('/upload', methods=['POST'])
17
  def upload_file():
18
  if 'photo' not in request.files:
 
52
  '''
53
  return render_template_string(html)
54
 
55
+ @app.route('/upload_form')
56
+ def upload_form():
57
+ html = '''
58
+ <!DOCTYPE html>
59
+ <html lang="en">
60
+ <head>
61
+ <meta charset="UTF-8">
62
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
63
+ <title>Upload Image</title>
64
+ </head>
65
+ <body>
66
+ <h1>Upload Image</h1>
67
+ <form action="/upload" method="post" enctype="multipart/form-data">
68
+ <input type="file" name="photo" accept="image/*">
69
+ <button type="submit">Upload</button>
70
+ </form>
71
+ <div id="message"></div>
72
+ </body>
73
+ </html>
74
+ '''
75
+ return render_template_string(html)
76
+
77
  @socketio.on('message')
78
  def handle_message(msg):
79
  print('Message: ' + msg)
 
86
 
87
  if __name__ == '__main__':
88
  socketio.run(app, host='0.0.0.0', port=7860, allow_unsafe_werkzeug=True)