WeShop commited on
Commit
784a144
·
1 Parent(s): e27ffa6
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -27,7 +27,7 @@ app_id = os.getenv('app_id')
27
  login_status_key = os.getenv('login_status_key')
28
  login_info_key = os.getenv('login_info_key')
29
  login_status_key2 = os.getenv('login_status_key2')
30
- login_mark_key = os.getenv('login_mark_key')
31
 
32
 
33
  def parse_response(response, state='default'):
@@ -288,10 +288,14 @@ def generate_image(edit_image_infos, did, request: gr.Request):
288
  if not did:
289
  did = str(uuid.uuid4())
290
  user_id, user_name = check_login_status(request.request.headers)
 
 
 
 
291
  if not user_id or not user_name:
292
  m = "Please log in to your Hugging Face account to use the features of this application."
293
  return gr.Warning(m), did
294
- user_id = f"{login_mark_key}{user_id}"
295
  if edit_image_infos is None or not isinstance(edit_image_infos, dict):
296
  m = "Please upload the main image before generating."
297
  return gr.Warning(m), did
 
27
  login_status_key = os.getenv('login_status_key')
28
  login_info_key = os.getenv('login_info_key')
29
  login_status_key2 = os.getenv('login_status_key2')
30
+ login_hash_key = os.getenv('login_hash_key')
31
 
32
 
33
  def parse_response(response, state='default'):
 
288
  if not did:
289
  did = str(uuid.uuid4())
290
  user_id, user_name = check_login_status(request.request.headers)
291
+ if not user_id:
292
+ user_id = request.session_hash
293
+ if not user_name:
294
+ user_name = request.session_hash
295
  if not user_id or not user_name:
296
  m = "Please log in to your Hugging Face account to use the features of this application."
297
  return gr.Warning(m), did
298
+ user_id = f"{login_hash_key}{user_id}"
299
  if edit_image_infos is None or not isinstance(edit_image_infos, dict):
300
  m = "Please upload the main image before generating."
301
  return gr.Warning(m), did