Kimang18 commited on
Commit
ccf3267
·
1 Parent(s): a190092

test user id in session

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -32,6 +32,7 @@ if not os.path.exists(OUT_FOLDER):
32
  @app.route('/', methods=['GET', 'POST'])
33
  def index():
34
  user_id = session.get('_id')
 
35
  if user_id is None:
36
  user_id = uuid.uuid4()
37
  session['_id'] = user_id
@@ -123,9 +124,12 @@ def label(id):
123
  @app.route('/image/<f>')
124
  def images(f):
125
  user_id = session.get('_id')
126
- images = app.config["IMAGES"] + f'/{user_id}'
127
- print(images, '/', f)
128
- return send_file(images +'/'+f)
 
 
 
129
 
130
  @app.route('/download')
131
  def download():
 
32
  @app.route('/', methods=['GET', 'POST'])
33
  def index():
34
  user_id = session.get('_id')
35
+ print(user_id)
36
  if user_id is None:
37
  user_id = uuid.uuid4()
38
  session['_id'] = user_id
 
124
  @app.route('/image/<f>')
125
  def images(f):
126
  user_id = session.get('_id')
127
+ print(user_id)
128
+ # images = app.config["IMAGES"] + f'/{user_id}'
129
+ img_path = os.path.join(UPLOAD_FOLDER, f'{user_id}/{f}')
130
+ # print(images, '/', f)
131
+ # return send_file(images +'/'+f)
132
+ return send_file(img_path)
133
 
134
  @app.route('/download')
135
  def download():